Submission #00002


ソースコード

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
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, p;
while(cin >> n >> p, n||p) {
int ps[50] = { 0 }, now = p, idx = 0;
while(true) {
if(now > 0) {
ps[idx]++;
now--;
// cout << idx << ":" << ps[idx] << " " << now << endl;
if(ps[idx] == p && now == 0) {
cout << idx << endl;
break;
}
} else {
// cout << idx << ":" << ps[idx] << " " << now << endl;
now = ps[idx];
ps[idx] = 0;
}
idx++;
idx = idx % n ;
}
}
}

ステータス

項目 データ
問題 0001 - 次期町長
ユーザー名 I dont any
投稿日時 2015-10-23 13:07:41
言語 C++11
状態 Accepted
得点 10
ソースコード長 516 Byte
最大実行時間 70 ms
最大メモリ使用量 704 KB

セット

セット 得点 Cases
1 ALL 10 / 10 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
a1 AC 70 ms 476 KB
1
a2 AC 64 ms 704 KB
1
a3 AC 62 ms 556 KB
1
a4 AC 66 ms 660 KB
1