摘要:
#include <stdio.h> int fib(int m){ int n_2=1,n_1=2,n,i; if(m==0)return 1; if(m==1)return 2; for(i=2;i<=m;i++) { n=(n_2+n_1)%3; n_2=n_1; n_1=n; } retur 阅读全文
摘要:
#include <stdio.h> int main(void){ int n,i,c; char txt[10001]; scanf("%d", &n); while(n--) { scanf("%s",txt); i=0; while(txt[i++]) { c=1; while(txt[i] 阅读全文
摘要:
#include <stdio.h> int gcd(int a, int b){ int t; while(t=a%b) { a=b; b=t; } return b;} int main(void){ int t,m,n,i,g,lcm; scanf("%d",&t); while(t--) { 阅读全文
摘要:
#include <stdio.h>#include <math.h> int main(void){ int t,n,i; double sum; scanf("%d", &t); while(t--) { scanf("%d",&n); sum=0; for(i=2;i<=n;i++) sum+ 阅读全文
摘要:
#include <stdio.h> int judge(int a, int b, int m){ return (a*a+b*b+m)%(a*b)==0;} int count(int m, int n){ int i,j,c; c=0; for(i=1;i<n;i++) { for(j=i+1 阅读全文
摘要:
#include <stdio.h>#include <string.h> int prime[38]={0,0,1,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1};int visit[21]={0,0,0 阅读全文
摘要:
#include <stdio.h>#include <string.h>#include <stdlib.h> int cmp(void* a, void* b){ return *((char*)a)-*((char*)b);} void solve(int t, char* dic){ int 阅读全文
摘要:
#include <stdio.h> int gcd(int a, int b){ int t; while(t=a%b) { a=b; b=t; } return b;} int main(void){ int s,m,i; while(scanf("%d %d", &s, &m)!=EOF) { 阅读全文
摘要:
#include<stdio.h> #include<string.h> int main() { char num[1000]; int len,sum,i; while(scanf("%s",&num)!=EOF) { len=strlen(num); if(len==1 && num[0]== 阅读全文
摘要:
#include<iostream>#include<stdio.h> using namespace std; int jiechen(int n){ int i; int ans=1; for(i=1;i<=n;i++) ans*=i; return ans;} int main(){ int 阅读全文