HDU 5832 A water problem (大数取模)

    xiaoxiao2025-09-01  5

    A water problem

    Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 496    Accepted Submission(s): 26 Problem Description Two planets named Haha and Xixi in the universe and they were created with the universe beginning. There is 73 days in Xixi a year and 137 days in Haha a year. Now you know the days N after Big Bang, you need to answer whether it is the first day in a year about the two planets. Input There are several test cases(about 5 huge test cases). For each test, we have a line with an only integer N(0N) , the length of N is up to 10000000 . Output For the i-th test case, output Case #i: , then output "YES" or "NO" for the answer. Sample Input 10001 0 333 Sample Output Case #1: YES Case #2: YES Case #3: NO Author UESTC Source 2016中国大学生程序设计竞赛 - 网络选拔赛 Recommend wange2014   |   We have carefully selected several similar problems for you:  5842 5841 5840 5838 5837  题解:如果这个数能%73=0和%137=0,就输出YES。否则NO 代码: #pragma comment(linker, "/STACK:102400000,102400000") //#include<bits/stdc++.h> #include<stdio.h> #include<string.h> #include<algorithm> #include<iostream> #include<cstring> #include<vector> #include<map> #include<cmath> #include<queue> #include<set> #include <utility> #include<stack> using namespace std; typedef long long ll; typedef unsigned long long ull; #define mst(a) memset(a, 0, sizeof(a)) #define M_P(x,y) make_pair(x,y) #define rep(i,j,k) for (int i = j; i <= k; i++) #define per(i,j,k) for (int i = j; i >= k; i--) #define lson x << 1, l, mid #define rson x << 1 | 1, mid + 1, r const int lowbit(int x) { return x&-x; } const double eps = 1e-8; const int INF = 1e9+7; const ll inf =(1LL<<62) ; const int MOD = 1e9 + 7; const ll mod = (1LL<<32); const int N = 1010; const int M=100010; template <class T1, class T2>inline void getmax(T1 &a, T2 b) {if(b>a)a = b;} template <class T1, class T2>inline void getmin(T1 &a, T2 b) {if(b<a)a = b;} int read() { int v = 0, f = 1; char c =getchar(); while( c < 48 || 57 < c ){ if(c=='-') f = -1; c = getchar(); } while(48 <= c && c <= 57) v = v*10+c-48, c = getchar(); return v*f; } char s[10000100]; int main() { #ifndef ONLINE_JUDGE freopen("in.txt","r",stdin); #endif int cas = 1; while(gets(s)){ int num = 0; for(int i=0; i<strlen(s); i++) { num=(num *10 + s[i]-'0') %10001; } if(num==0) printf("Case #%d: YES\n",cas++); else printf("Case #%d: NO\n",cas++); } return 0; }  
    转载请注明原文地址: https://ju.6miu.com/read-1302189.html
    最新回复(0)