Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 17294 Accepted Submission(s): 6778
#include <iostream> #include <stack> #include <cstring> #include <cstdio> #include <string> #include <algorithm> #include <queue> #include <set> using namespace std; /* */ #define ms(arr, val) memset(arr, val, sizeof(arr)) #define N 100005 #define INF 0x3fffffff #define vint vector<int> #define sint set<int> int tag[N]; int main() { int s, mod, t, i; while (cin>>s>>mod) { ms(tag, 0); t = 0; tag[0] = 1; for (i = 1; i < mod; i++) { t = (t + s) % mod; if (tag[t]) { printf("%10d%10d Bad Choice\n", s, mod); break; } } if (i == mod) { printf("%10d%10d Good Choice\n", s, mod); } cout << endl; } return 0; }
hdu 1014 Uniform Generator,布布扣,bubuko.com
原文:http://www.cnblogs.com/jecyhw/p/3897554.html