Submission #00050
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #include<bits/stdc++.h> using namespace std; #define int int64_t #define rep(i,a,n) for(int i=(a); i<(n); ++i) #define reps(i,a,n) for(int i=(a); i<(n); --i) #define gsort(x,n) sort((x),(x)+(n),greater<int>()) #define all(x) (x).begin(), (x).end() #define re(s) reverse((s).begin(),(s).end()) #define setout(n,x) setw(n) << setfill(x) #define Fixed fixed << setprecision(10) constexpr int INF = 0x3f3f3f3f; constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL; constexpr int mod = 1000000007; using pii = pair< int , int >; signed main(){ cin.tie(nullptr); ios_base::sync_with_stdio( false ); int n,m,a,cnt=0,ans=0; while (1){ cin>>n>>m; if (n == 0 && m == 0) break ; ans = 0; cnt = m / n; vector< int > x(n); rep(i,0,n){ cin>>x[i]; if (x[i] >= cnt) ans += cnt; else ans += x[i]; } cout<<ans<< '\n' ; } return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0002 - 割り勘 |
ユーザー名 | immunity |
投稿日時 | 2020-03-27 09:30:43 |
言語 | C++17 |
状態 | Accepted |
得点 | 8 |
ソースコード長 | 910 Byte |
最大実行時間 | 28 ms |
最大メモリ使用量 | 680 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | A1 | 2 / 2 | A1 |
2 | A2 | 2 / 2 | A2 |
3 | A3 | 2 / 2 | A3 |
4 | A4 | 2 / 2 | A4 |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | |||
---|---|---|---|---|---|---|---|
A1 | AC | 19 ms | 604 KB |
1
|
|||
A2 | AC | 20 ms | 680 KB |
2
|
|||
A3 | AC | 17 ms | 624 KB |
3
|
|||
A4 | AC | 28 ms | 448 KB |
4
|