Codeforces Round #387 (Div. 2), problem: (F) Igor and Interesting Numbers Solution in C/C++

By |2017-04-07T22:11:45+00:00January 6th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , |

Codeforces Round #387 (Div. 2), problem: (F) Igor and Interesting Numbers Solution in C/C++   #include <bits/stdc++.h> #define ll long long using namespace std; const int N=1<<16; int k,t,len; ll c[200][200]; void print(int x) { x--; if(x<10) cout<<x; else cout<<char('a'+x-10); } ll dp[20][200]; int [...]

Codeforces Round #387 (Div. 2), problem: (E) Comments Solution in C/C++

By |2017-04-07T22:11:45+00:00January 6th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , |

Codeforces Round #387 (Div. 2), problem: (E) Comments Solution in C/C++   #include <stdio.h> #include <string.h> #include <stdlib.h> #define N 1000000 int ccnt; struct comment { char *s; int d, i; } cc[N]; char *ss[N]; int parse(int d, int i) { int k = [...]

Codeforces Round #387 (Div. 2), problem: (D) Winter Is Coming Solution in C/C++

By |2017-04-07T22:11:46+00:00January 6th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , |

Codeforces Round #387 (Div. 2), problem: (D) Winter Is Coming Solution in C/C++     #include <limits.h> #include <stdio.h> #include <stdlib.h> int compare(const void *a, const void *b) { int *pa = (int *) a; int *pb = (int *) b; return *pb - [...]

Codeforces Round #387 (Div. 2), problem: (C) Servers Solution in C/C++

By |2017-04-07T22:11:46+00:00January 6th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , |

Codeforces Round #387 (Div. 2), problem: (C) Servers Solution in C/C++   #include<stdio.h> int main(){ int n,q,a[100]={0},t,k,d,i,j,s,f; scanf("%d%d",&n,&q); while(q>0) { scanf("%d%d%d",&t,&k,&d); s=0; for(i=0;i<n;i++) { if(a[i]<t) a[i]=0; } j=0; for(i=0;i<n;i++) { if(a[i]==0) j++; } if(j<k) printf("-1\n"); else {for(i=0,j=0;i<n&&j<k;i++) { if(a[i]==0) { s+=i+1; a[i]=t+d-1;j++;} } printf("%d\n",s);} [...]

Codeforces Round #387 (Div. 2), problem: (B) Mammoth’s Genome Decoding Solution in C/C++

By |2017-04-07T22:11:46+00:00January 6th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , |

Codeforces Round #387 (Div. 2), problem: (B) Mammoth's Genome Decoding Solution in C/C++   #include <stdio.h> char cc[] = { 'A', 'C', 'G', 'T' }; int cnt[4]; void incr(char c) { int i; for (i = 0; i < 4; i++) if (cc[i] == [...]

Codeforces Round #387 (Div. 2), problem: (A) Display Size Solution in C/C++

By |2017-04-07T22:11:46+00:00January 6th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , |

Codeforces Round #387 (Div. 2), problem: (A) Display Size Solution in C/C++   int main(){ long long int x,i; scanf("%I64d",&x); i=sqrt(x); while(x%i){ i--; } printf("%I64d %I64d",i,x/i); }