11 2019 档案
Codeforces 432A
摘要:#include <stdio.h> #include <stdlib.h> int comp_inc(const void *first, const void *second) { return *(int *)first-*(int *)second; } int times[2048]; i
阅读全文
Codeforces 427A
摘要:#include <stdio.h> int main() { int min=0; int num; int temp; int sum=0; scanf("%d", &num); while(num--) { scanf("%d", &temp); sum+=temp; if((sum<0)&&
阅读全文
Codeforces 313A
摘要:#include <stdio.h> int main() { long long n; int a, b; scanf("%lld", &n); if(n>0) ; else { if((n>=(-10))&&(n<0)) n=0; else { a=(n%10)*(-1); b=((n/10)%
阅读全文
Coding笔记
摘要:@在已知输入数据规模的前提下,定义数组的时,数组的大小一定要严格且略大于该规模! @C语言中qsort函数的用法。头文件:#include <stdlib.h>。 #include <stdio.h> #include <stdlib.h> int comp_inc(const void *firs
阅读全文
Codeforces 758A
摘要:#include <stdio.h> int main() { int a[120]; int num; scanf("%d", &num); int i; int max=-1; for(i=0; i<num; ++i) { scanf("%d", &a[i]); if(a[i]>max) max
阅读全文
Codeforces 732A
摘要:#include <stdio.h> #define min(x, y) (x<y?x:y) int main() { int a[10]={0, 10, 5, 10, 5, 2, 5, 10, 5, 10}; int k, r; scanf("%d %d", &k, &r); int temp=k
阅读全文
Codeforces 750A
摘要:#include <stdio.h> int main() { int n, k; scanf("%d %d", &n, &k); int ans, i; int sum=0; for(i=0; i<=n; ++i) { sum+=i; if((5*sum)<=(240-k)) ans=i; els
阅读全文
Codeforces 723A
摘要:#include <stdio.h> #define max(x, y, z) (x>y?x>z?x:z:y>z?y:z) #define min(x, y, z) (x<y?x<z?x:z:y<z?y:z) int main() { int a, b, c; scanf("%d %d %d", &
阅读全文
Codeforces 155A
摘要:#include <stdio.h> int main() { int n; scanf("%d", &n); int temp; scanf("%d", &temp); int min=temp; int max=temp; int Count=0; while(--n) { scanf("%d"
阅读全文
Codeforces 581A
摘要:#include <stdio.h> #include <math.h> int main() { int a, b; scanf("%d %d", &a, &b); int temp; if(a<b) { temp=a; a=b; b=temp; } printf("%d %d\n", b, ((
阅读全文
Python笔记
摘要:首先Python与其他主流编程语言有两个直观的不同点:1、变量命名时不需要指出变量类型。2、每个语句的结尾不再需要';'。这个两地方在编程过程中确实能节省很多敲击次数,不过由于本人目前只写过长度为几十行代码,不知道在编写大型程序时,这种方式会有多大的优点或者存在哪些不便之处。 @要运行Python程
阅读全文
Codeforces 785A
摘要:#include <stdio.h> int main() { char line[30]; int n; scanf("%d", &n); getchar(); int ans=0; while(n--) { scanf("%s", line); if(line[0]=='T') ans+=4;
阅读全文
Codeforces 1243B1
摘要:#include <stdio.h> #include <string.h> # define MaxSize 10010 char line_0[MaxSize]; char line_1[MaxSize]; int main() { int k; int n; scanf("%d", &k);
阅读全文
Codeforces 1243A
摘要:#include <stdio.h> #include <string.h> int num[1024]; int main() { int k; int n; int temp; scanf("%d", &k); while(k--) { memset(num, 0, sizeof(int)*10
阅读全文
Codeforces 339B
摘要:#include <stdio.h> int main() { int n, m; long long Count=0; scanf("%d%d", &n, &m); int cur, pre=1; while(m--) { scanf("%d", &cur); if(cur>pre) Count+
阅读全文
Codeforces 141A
摘要:#include <stdio.h> #include <string.h> #include <stdbool.h> int main() { char line1[110]; char line2[110]; char line3[210]; scanf("%s", line1); scanf(
阅读全文
Codeforces 472A
摘要:#include <stdio.h> #include <math.h> #include <stdbool.h> int IsPrime(int n) { if(n==1) return 1; if(n==2) return 1; if(n%2==0) return 0; int end=sqrt
阅读全文
Codeforces 977A
摘要:#include <stdio.h> int main() { int n; int k; scanf("%d%d", &n, &k); while(k--) { if((n%10)!=0) --n; else n/=10; } printf("%d\n", n); return 0; }
阅读全文
Codeforces 520A
摘要:#include <stdio.h> #include <string.h> #include <stdbool.h> int main() { int n; scanf("%d", &n); char line[120]; scanf("%s", line); int alp[30]; int C
阅读全文
Codeforces 228A
摘要:#include <stdio.h> #include <stdlib.h> int comp_inc(const void *first, const void *second); int main() { int a[5]; int i; for(i=0; i<4; ++i) { scanf("
阅读全文
Codeforces 268A
摘要:#include <stdio.h> #define Maxsize 50 struct uniform { int h; int g; }; int main() { int n; scanf("%d", &n); struct uniform Set[Maxsize]; int i; for(i
阅读全文
Codeforces 200B
摘要:#include <stdio.h> int main() { int n; double num; scanf("%d", &n); int i; double sum=0.0; for(i=0; i<n; ++i) { scanf("%lf", &num); sum+=num; } printf
阅读全文
Codeforces 443A
摘要:#include <stdio.h> #include <string.h> #define Maxsize 3200 int main() { int letter[30]; memset(letter, 0, sizeof(letter)); char line[Maxsize]; gets(l
阅读全文
Codeforces 25A
摘要:#include <stdio.h> int main() { int n; int temp; int Count1=0, Count2=0; int Index1, Index2; scanf("%d", &n); int i; for(i=0; i<n; ++i) { scanf("%d",
阅读全文
Codeforces 705A
摘要:#include <stdio.h> int main() { int n; scanf("%d", &n); int i; for(i=1; i<=n; ++i) { if(i!=1) printf(" that "); if(i%2!=0) printf("I hate"); else prin
阅读全文
Codeforces 451A
摘要:#include <stdio.h> int main() { int n, m; int Count=0; scanf("%d%d", &n, &m); while((n>0)&&(m>0)) { --n; --m; ++Count; } if(Count%2==0) printf("Malvik
阅读全文
Codeforces 144A
摘要:#include <stdio.h> int main() { int max=-1, min=1000; int max_ind=0, min_ind=0; int n; int line; scanf("%d", &n); int i; for(i=0; i<n; ++i) { scanf("%
阅读全文
Codeforces 469A
摘要:#include <stdio.h> #include <string.h> #include <stdlib.h> #define Maxsize 110 int comp_inc(const void *first, const void *second); int main() { int L
阅读全文
Codeforces 791A
摘要:#include <stdio.h> int main() { int a, b; int Count=0; scanf("%d%d", &a, &b); while(a<=b) { ++Count; a*=3; b*=2; } printf("%d\n", Count); return 0; }
阅读全文
Codeforces 61A
摘要:#include <stdio.h> #include <string.h> #define Maxsize 110 int main() { char line1[Maxsize]; char line2[Maxsize]; scanf("%s", line1); scanf("%s", line
阅读全文
Codeforces 405A
摘要:#include <stdio.h> #include <stdlib.h> #define Maxsize 110 int comp_inc(const void *first, const void *second); int columns[Maxsize]; int main() { int
阅读全文
Codeforces 677A
摘要:#include <stdio.h> int main() { int n, h; scanf("%d%d", &n, &h); int temp, width=0; int i; for(i=0; i<n; ++i) { scanf("%d", &temp); if(temp<=h) ++widt
阅读全文
Codeforces 344A
摘要:#include <stdio.h> int main() { int a, b; int n; scanf("%d", &n); scanf("%d", &a); int Count=1; int i; for(i=0; i<n-1; ++i) { scanf("%d", &b); if((a%1
阅读全文
Codeforces 318A
摘要:#include <stdio.h> int main() { long long n, k; scanf("%I64d%I64d", &n, &k); long long even; if(n%2==0) even=n/2; else even=(n/2)+1; if(k<=even) print
阅读全文
Codeforces 208A
摘要:#include <stdio.h> #include <string.h> #include <stdbool.h> #define Maxsize 210 int main() { char sentence[Maxsize]; char wub[4]={'W', 'U', 'B'}; scan
阅读全文
Codeforces 148A
摘要:#include <stdio.h> #include <string.h> int main() { int a[5]; int total; memset(a, 0, sizeof(a)); int i; for(i=1; i<=4; ++i) { scanf("%d", &a[i]); } s
阅读全文
Codeforces 546A
摘要:#include <stdio.h> int main() { int k, n , w; scanf("%d%d%d", &k, &n, &w); int ans=(k*((w*(w+1))/2))-n; if(ans>0) printf("%d\n", ans); else printf("%d
阅读全文
Codeforces 486A
摘要:#include <stdio.h> int main() { long long ans; long long n; scanf("%I64d", &n); long long i; if(n%2==0) ans=((n/2)*((n/2)+1))-((n/2)*(n/2)); else ans=
阅读全文
Codeforces 59A
摘要:#include <stdio.h> #include <string.h> #define MAXSIZE 120 int main() { int cntlow=0; int cntupp=0; char str[MAXSIZE]; memset(str, 0, sizeof(str)); sc
阅读全文
Codeforces 136A
摘要:#include <stdio.h> #include <string.h> #define MAXSIZE 110 int main() { int giv[MAXSIZE]; int rec[MAXSIZE]; memset(giv, 0, sizeof(giv)); memset(rec, 0
阅读全文
Codeforces 337A
摘要:#include <stdio.h> #include <stdlib.h> #define MAXSIZE 60 int comp_inc(const void *first, const void *second); int main() { int pieces[MAXSIZE]; int n
阅读全文
Codeforces 617A
摘要:#include <stdio.h> int main() { int moves[5]={1,2,3,4,5}; int x; scanf("%d", &x); int ind=4; int Minsteps=0; while((x!=0)&&(ind>=0)) { if(x>=moves[ind
阅读全文
Codeforces 580A
摘要:#include <stdio.h> #include <string.h> #define MAXSIZE 100024//之前数据少开了一个量级 int money[MAXSIZE]; int main() { memset(money, 0, sizeof(money)); int a; sc
阅读全文
Codeforces 271A
摘要:#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> int comp(const void *a, const void *b); int main () { int year; int a[
阅读全文
Codeforces 41A
摘要:#include <stdio.h> #include <string.h> #define MAXSIZE 105 int main() { char Berlandish[MAXSIZE]; char Birlandish[MAXSIZE]; scanf("%s", Berlandish); s
阅读全文
Codeforces 266B
摘要:#include <stdio.h> #define MAXSIZE 1024 char que[MAXSIZE]; int main() { int n, t; scanf("%d %d", &n, &t); scanf("%s", que); int i, j; char temp; for(j
阅读全文
Codeforces 110A
摘要:#include <stdio.h> #include<string.h> #define MAXSIZE 30 int main() { char digits[30]; memset(digits, 0, sizeof(digits)); scanf("%s", digits); int len
阅读全文
Codeforces 131A
摘要:#include <stdio.h> #include <string.h> #include <stdbool.h> #define MAXSIZE 105 int main() { char str[MAXSIZE]; scanf("%s", str); int length=strlen(st
阅读全文
Codeforces 467A
摘要:#include <stdio.h> int main() { int n; int p, q; int rooms=0; scanf("%d", &n); int i; for(i=0; i<n; ++i) { scanf("%d %d", &p, &q); if((q-p)>=2) ++room
阅读全文
Codeforces 133A
摘要:#include <stdio.h> #include<string.h> #include <stdbool.h> #define MAXSIZE 105 int main() { char str[MAXSIZE]; scanf("%s", str); int length=strlen(str
阅读全文
Codeforces 160A
摘要:#include <stdio.h> int main() { int n; int sum1=0, sum2=0, sum3=0; int x, y, z; scanf("%d", &n); int i; for(i=0; i<n; ++i) { scanf("%d %d %d", &x, &y,
阅读全文
Codeforces 69A
摘要:#include <stdio.h> int main() { int n; int sum1=0, sum2=0, sum3=0; int x, y, z; scanf("%d", &n); int i; for(i=0; i<n; ++i) { scanf("%d %d %d", &x, &y,
阅读全文
Codeforces 122A
摘要:#include <stdio.h> int main() { int dig; int flag=0; scanf("%d", &dig); if(dig%4==0) flag=1; else if(dig%7==0) flag=1; else if(dig%44==0) flag=1; else
阅读全文
Codeforces 58A
摘要:#include <stdio.h> #include <string.h> int main() { char hel[6]="hello"; char str[120]; memset(str, 0, sizeof(str)); scanf("%s", str); int length=strl
阅读全文
Codeforces 236A
摘要:#include <stdio.h> #include <string.h> int main() { char str[150]; int arr[35]; memset(str, 0, sizeof(str)); memset(arr, 0, sizeof(str)); scanf("%s",
阅读全文
Codeforces 116A
摘要:#include <stdio.h> int main() { int n; int a1,a2; int min=0; int cap=0; scanf("%d",&n); while(n>0) { scanf("%d %d",&a1,&a2); cap-=a1; cap+=a2; if(min<
阅读全文
Codeforces 266A
摘要:#include <iostream> #include <string> using namespace std; int main() { string stones; int n,count; while(cin>>n>>stones) { count=0; for(int i=0; i<st
阅读全文
Codeforces 158A
摘要:#include <iostream> #include <algorithm> using namespace std; int main() { int groups[100009], num[5]; int n, sum; while(cin>>n) { sum=num[1]=num[2]=n
阅读全文
263A
摘要:#include<stdio.h> #include<stdlib.h> int main() { int i, j; int temp; int t_i, t_j; int ans; for(i=1; i<=5; ++i) for(j=1; j<=5; ++j) { scanf("%d",&tem
阅读全文
Codeforces 281A
摘要:#include <iostream> #include <string> #include <cctype> using namespace std; int main() { string word; cin>>word; word[0]=toupper(word[0]); cout<<word
阅读全文
Codeforces 339A
摘要:#include <iostream> #include <string> #include <algorithm> using namespace std; #define maxSize 105 int main() { string exp; int digit[maxSize]; int l
阅读全文
Codeforces 112A
摘要:#include <iostream> #include <string> #include <cctype> using namespace std; int main() { string str1; string str2; int length; while(cin>>str1>>str2)
阅读全文
Codeforces 96A
摘要:#include <iostream> #include <string> #include <cctype> using namespace std; int main() { string str1; string str2; int length; while(cin>>str1>>str2)
阅读全文
Codeforces 282A
摘要:#include <iostream> #include <string> using namespace std; int main() { int n, plus, sub; string ope; while(cin>>n) { plus=sub=0; while(n--) { cin>>op
阅读全文
Codeforces 50A
摘要:#include <iostream> using namespace std; int main() { int m, n; cin>>m>>n; cout<<(m*n)/2<<endl; return 0; }
阅读全文
Codeforces 231A
摘要:#include <iostream> using namespace std; #define maxSize 10 int main() { int views[maxSize]; int n, res; while(cin>>n) { res=0; for(int i=0; i<n; ++i)
阅读全文
Codeforces 118A
摘要:#include <iostream> #include <cctype> #include <string> using namespace std; int main() { string str; cin>>str; int length; length=str.size(); for(int
阅读全文
Codeforces 158A
摘要:#include <iostream> using namespace std; #define maxSize 60 int main() { int score[maxSize]; int n, k, res; cin>>n>>k; res=0; for(int i=0; i<n; ++i) c
阅读全文
Codeforces 71A
摘要:#include <iostream> #include <string> using namespace std; int main() { string word; int length, n; cin>>n; for(int i=0; i<n; ++i) { cin>>word; length
阅读全文
Codeforces 1A
摘要:#include <iostream> using namespace std; int main() { long long n, m, a, r, c; cin>>n>>m>>a; r=n/a; if(n%a!=0) ++r; c=m/a; if(m%a!=0) ++c; cout<<r*c<<
阅读全文
Codeforces 4A
摘要:#include <iostream> using namespace std; int main() { int a; cin>>a; if((a>=4) && (a%2==0)) cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0; }
阅读全文
Codeforces 510A
摘要:#include <stdio.h> int main() { int n, m; scanf("%d %d", &n, &m); int i, j; int Count=0; for(i=1; i<=n; ++i) { if((i%2)!=0) { for(j=0; j<m; ++j) print
阅读全文
Codeforces 492B
摘要:#include <stdio.h> #include <stdlib.h> int comp(const void *first, const void *second); int lanterns[1024]; int main() { int n, l; scanf("%d %d", &n,
阅读全文
Codeforces 230A
摘要:#include <stdio.h> int data[1024][2]; int main() { int s, n; scanf("%d %d", &s, &n); int i; for(i=0; i<n; ++i) { scanf("%d %d", &data[i][0], &data[i][
阅读全文
Codeforces 1030A
摘要:#include <stdio.h> int main() { int num; scanf("%d", &num); int i, sum=0; int temp; for(i=0; i<num; ++i) { scanf("%d", &temp); sum+=temp; } if(sum) pr
阅读全文
浙公网安备 33010602011771号