大数取模 HDU 5832
发布时间:2021-01-24 10:27 所属栏目:[大数据] 来源:网络整理
导读:int mod(char str[],int num) { int remainder=0; int len = strlen(str); for(int i=0;ilen;i++) { remainder=(remainder*10+(str[i] - '0'))%num; } return remainder;} HDU 5832 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5832 题意:能被73
int mod(char str[],int num) { int remainder=0; int len = strlen(str); for(int i=0;i<len;i++) { remainder=(remainder*10+(str[i] - '0'))%num; } return remainder; } HDU 5832 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5832 题意:能被73和137整除就输出YES。 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; char str[10000100]; int mod(char str[],int num) { int remainder=0; int len = strlen(str); for(int i=0;i<len;i++) { remainder=(remainder*10+(str[i] - '0'))%num; } return remainder; } int main() { int kase = 1; while(~scanf("%s",str)) { printf("Case #%d: ",kase++); if(mod(str,73) == 0 && mod(str,137) == 0) puts("YES"); else puts("NO"); } return 0; } 【免责声明】本站内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。 |
相关内容
网友评论