| input | output |
|---|---|
123456123456 |
1 |
开始刷刷URAL。。先水一个
AC代码:
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <cctype>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define INF 0x7fffffff
using namespace std;
char s[105];
int main() {
scanf("%s", s);
int len = strlen(s);
int ans = s[0] - '0';
for(int i = 1; i < len; i ++) {
ans = (ans * 10 + s[i] - '0') % 7;
}
printf("%d\n", ans);
return 0;
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
URAL - 1243 - Divorce of the Seven Dwarfs (大数取模)
原文地址:http://blog.csdn.net/u014355480/article/details/47005957