timus1180
A Stone Game
http://acm.timus.ru/problem.aspx?space=1&num=1180
1
2 #include
3 #include
4
5 int main() {
6 char c;
7 int i = 0;
8 while(scanf("%c", &c) != EOF) {
9 if(isdigit(c)) {
10 i += c-'0';
11 }
12 }
13 if(i%3==0)
14 printf("2");
15 else
16 printf("1\n%d", i%3);
17 }
1
2 #include
3 #include
4 using namespace std;
5
6 int main() {
7 char c;
8 int i = 0;
9 while(cin >> c) {
10 if(isdigit(c)) {
11 i += c-'0';
12 }
13 }
14 if(i%3==0)
15 cout << '2';
16 else
17 cout <<"1\n" << i%3;
18 }
timus1180 (2008-06-01 11:42:38由czk编辑)