A Stone Game

http://acm.timus.ru/problem.aspx?space=1&num=1180

   1 /*Written by czk*/
   2 #include <stdio.h>
   3 #include <ctype.h>
   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 /*Written by czk*/
   2 #include <iostream>
   3 #include <cctype>
   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编辑)

ch3n2k.com | Copyright (c) 2004-2020 czk.