Monthly Archives: September 2016

137C History

Problem Link <Source Code> #include<bits/stdc++.h> #define ll long long #define pr pair<ll,ll> using namespace std; int main() { long long n,i; cin>>n; pr b[n]; for(int i=0;i<n;i++) { cin>>b[i].first>>b[i].second;} sort(b,b+n); ll mx=b[0].second; ll res=0; for(i=1;i<n;i++){ if(mx>=b[i].second) res++; else mx=b[i].second; } co

Rate this:

Posted in Codeforces, Uncategorized | Tagged , , | Leave a comment

443A

  Problem Link <Source Code> #include<bits/stdc++.h> using namespace std; #include<set> int main() { string str; getline(cin,str); set<char> letter; for(int i=1;i<str.size();i++) { if(‘a'<=str[i] &&str[i]<=’z’) letter.insert(str[i]); } cout<<letter.size()<<endl; }

Rate this:

Posted in Uncategorized | Leave a comment

208A.Dubstep

Problem Link <Source Code> #include<string.h> #include<stdio.h> int main() { char a[1000]; int l,i,m,n,flag=0; gets(a); l=strlen(a); if(a[0]==’W’&&a[1]==’U’&& a[2]==’B’) printf(“”); for(i=0;i<l;i++) { if(a[i+0]==’W’&&a[i+1]==’U’&& a[i+2]==’B’) { printf(” “); i+=2; } else{ printf(“%c”,a[i]); } } printf(“\n”); }

Rate this:

Posted in Uncategorized | Leave a comment

13059 – Tennis Championship

Problem Link <Source Code> #include <bits/stdc++.h> using namespace std; int main() { long long n; while (scanf(“%lld”, &n) == 1) printf(“%lld\n”, n-1); return 0; }

Rate this:

Posted in Uncategorized | Leave a comment

12798 – Handball

Problem Link <Source Code> #include<bits/stdc++.h> #define ll long long using namespace std; int main() { ll n,i,j,co=0,maxg,m,x,goal; while(scanf(“%lld %lld”,&n,&m)==2) {goal=0,co=0,maxg=0; for(i=0;i<n;i++) { co=0; for(j=0;j<m;j++) { scanf(“%lld”,&x); if(x>0) co++; } if(co==m) {goal++; } maxg=max(goal,maxg); } printf(“%lld\n”,goal); } }

Rate this:

Posted in Uncategorized | Leave a comment

1072 – Calm Down

Problem Link <Source Code> #include<stdio.h> #define pi acos(-1) int main() { int t,i; double R,r,n,angle; scanf(“%d”,&t); for(i=0;i<t;i++) {scanf(“%lf %lf”,&R,&n); angle=(pi)/(n); r=R*(sin(angle))/(sin(angle)+1); printf(“Case %d: %.10lf\n”,i+1,r); } return 0; }

Rate this:

Posted in Uncategorized | Leave a comment

1053 – Higher Math

Problem Link <Source Code> #include<stdio.h> //#include<algorithm> #define max(a,b) a>b?a:b #define min(a,b) a<b?a:b int main() { int a,b,c,t,i,temp; scanf(“%d”,&t); for(i=1;i<=t;i++) { scanf(“%d %d %d”,&a,&b,&c); printf(“Case %d: %s\n”,i,((a*a+b*b)==c*c||(a*a+c*c)==b*b||(b*b+c*c)==a*a)?”yes”:”no”); } return 0; }

Rate this:

Posted in Uncategorized | Leave a comment