ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1180. Игра с камушками

Here is my source!

#include <stdio.h>
int main(){
char ch;
int sumall=0;
while (!feof(stdin)) {scanf("%c",&ch); if (feof(stdin))
break;sumall+=ch-48;}
//printf("s=%d",sumall);
printf("%d\n",(sumall%3==0)+1);
if (sumall%3) printf("%d",sumall%3);
return 0;
}

Thanks!!!
ijk Here it is! [2] // Задача 1180. Игра с камушками 7 мар 2002 04:19
#include <stdio.h>
int main(){
char ch;
int sumall=0;
while (!feof(stdin)) {scanf("%c",&ch);
if (feof(stdin)) break;
if (ch>='0' && ch<='9')sumall+=(ch-'0');}<---check at this :)
sumall%=3;
printf("%d",((sumall==0)+1));
if (sumall) printf("\n%d",sumall);
return 0;
}
Vladimir Milenov Vasilev Thank you...I got accepted! // Задача 1180. Игра с камушками 7 мар 2002 14:00
grandvic Re: Here it is! // Задача 1180. Игра с камушками 22 апр 2012 03:48
Als0, we can use sumall+=ch instead of sumall+=(ch-'0'), because '0' == 0x30 == 3*16 :)