POJ 1597 Uniform Generator
2011-03-04 20:28
267 查看
根据循环群的知识,step的生成群的周期为n/gcd(step,n),所以,只有当gcd(step,n)=1时,才是一个good choice
代码:
代码:
#include<iostream> #include<cstdio> #include<memory.h> using namespace std; __int64 gcd(__int64 a,__int64 b) { if(b==0) return a; else return gcd(b,a%b); } int main() { __int64 a,b,d; while(scanf("%I64d%I64d",&a,&b)!=EOF) { d=gcd(a,b); printf("%10I64d%10I64d ",a,b); if(d!=1) printf("Bad Choice/n"); else printf("Good Choice/n"); printf("/n"); } return 0; }
相关文章推荐
- POJ 2546 & ZOJ 1597 Circular Area(求两圆相交的面积 模板)
- POJ 1597 Uniform Generator 模拟
- poj 1597 Uniform Generator【生成指定范围内所有随机数】
- poj1597 Uniform Generator
- poj 1597 Uniform Generator
- POJ 2546 & ZOJ 1597 Circular Area(求两圆相交的面积 模板)
- poj 1019 Number Sequence && hdu 1597 find the nth digit(二分,模拟)
- POJ 1597 Uniform Generator 笔记
- zoj 1597 || poj 2546 Circular Area(数学题)
- 【POJ 1597】【数论】 Uniform Generator
- POJ 1597 Function Run Fun
- CodeForces 600D Area of Two Circles' Intersection 圆面积交 (POJ 2546, ZOJ 1597)
- poj 1597(水模拟)
- poj 1597 搜索NO,数论YES
- POJ - 1597 英语阅读题..
- POJ 1597 find the nth digit (找规律)
- poj-1597
- poj 1597 Uniform Generator
- POJ 2546 & ZOJ 1597 Circular Area 两圆的面积交
- ZOJ 1597 Circular Area(POJ 2546)(两个圆的位置关系)