果断开小号水过
#include#include #include using namespace std;char a[]="hello";char s[1000];int main(){ while(cin>>s) { int k=0; for(int i=0;i
#include#include #include #include using namespace std;int main(){ int n; while(scanf("%d",&n)!=EOF) { if(n==1) { printf("1\n"); continue; } int k=n; printf("%d ",n); while(n--) { if(n==1) break; if(k%n==0) {printf("%d ",n);k=n;} } printf("1\n"); } return 0;}
#include#include #include #include #define MAXN 110#define clr(a,b); memset(a,b,sizeof(a));using namespace std;int n,m;int a,b;int p[MAXN];int circle[MAXN];int sum;int num[MAXN];int find(int x){ return x==p[x]?x:find(p[x]);}int main(){ while(scanf("%d%d",&n,&m)!=EOF) { sum=0; clr(circle,0); clr(num,0); int k=0; for(int i=0;i
#include#include #define MAXN 1000003using namespace std;long long a[MAXN];long long n;int main(){ a[0]=1; for(int i=1;i =MAXN) printf("0\n"); else printf("%I64d\n",a[n]); } } return 0;}
#include#include #include #include using namespace std;int n;int tmp;int x[100010];int main(){ while(scanf("%d",&n)!=EOF) { memset(x,0,sizeof(x)); for(int i=0;i
#include#include #include using namespace std;struct node{ int x; int y; int dir;}robot[110];struct node1{ int rob; char action; int repeat;}move[110];int A,B;int N,M;char tmp;int dy[]={ 1,0,-1,0};int dx[]={ 0,1,0,-1};int map[110][110];int flag;void judge(int num,int x,int y){ if(x<=0||x>A||y<=0||y>B) { printf("Robot %d crashes into the wall\n",num); flag=1;return; } if(map[x][y]==0) { map[x][y]=num; return; } else { printf("Robot %d crashes into robot %d\n",num,map[x][y]); flag=1;return; }}int main(){ int t; while(scanf("%d",&t)!=EOF) { while(t--) { flag=0; memset(map,0,sizeof(map)); scanf("%d%d",&A,&B); scanf("%d%d",&N,&M); for(int i=1;i<=N;i++) { cin>>robot[i].x>>robot[i].y>>tmp; map[robot[i].x][robot[i].y]=i; if(tmp=='N') robot[i].dir=0; else if(tmp=='E') robot[i].dir=1; else if(tmp=='S') robot[i].dir=2; else if(tmp=='W') robot[i].dir=3; } for(int i=1;i<=M;i++) { cin>>move[i].rob>>move[i].action>>move[i].repeat; } for(int i=1;i<=M;i++) { if(move[i].action=='F') { for(int j=0;j