#include <stdio.h> int main () { int problem1,prblm [20],required [20],tc = 0; while ( scanf ("%d", &problem1)== 1 ) { if ( problem1 < 0 ) return 0; prblm [0] = problem1; int i; for ( i = 1; i < 13; i++ ) scanf ("%d", &prblm [i]); for ( i =...
#include <stdio.h> int main () { int problem1,prblm [20],required [20],tc = 0; while ( scanf ("%d", &problem1)== 1 ) { if ( problem1 < 0 ) return 0; prblm [0] = problem1; int i; for ( i = 1; i < 13; i++ ) scanf ("%d", &prblm [i]); for ( i =...
#include<bits/stdc++.h> using namespace std; int main () { int p ,i, n ,l; int c = 0; while(cin>>n) { if(n<0) { break; } else { for(i=0;i<n;i++) { l=pow(2,i); if(l>=n) break; } } printf("Case %d: %d\n",c+1,i); c++; } return 0; }...
#include<bits/stdc++.h> bool flag[10000000]; long long int List[200000],primes[10000017]; int listSize,cnt,loc; using namespace std; void sieve(int n) { cnt=0; primes[cnt++]=2; for(int i=3;i<=n;i+=2) { if(flag[i]==0) { primes[cnt++]=i; }...
#include <bits/stdc++.h> using namespace std; int main() { int tc, hour, mint; cin>>tc; while(tc--) { scanf("%d:%d", &hour, &mint); hour= 11-hour + (mint == 0); if(hour <= 0) hour=hour+12; if(mint != 0) mint = 60-mint;...
#include <bits/stdc++.h> using namespace std; int main() { int h1,m1,h2,m2; while(cin>>h1>>m1>>h2>>m2) { if(h1==0 && m1==0 && h2==0 && m2==0) break; h1*=60; h1+=m1; h2*=60; h2+=m2;...
#include <bits/stdc++.h> using namespace std; int main() { int e,f,t,div,ate,val,c,rem; scanf("%d",&t); while(t--) { scanf("%d %d %d",&e,&f,&c); ate=0; val=e+f; while(val>=c) { div=val/c; ate+=div; rem=val%c; val=div+rem; }...
#include <string.h> #include <stdio.h> char s1[1000],s2[1000],n1[1000],n2[1000]; int main() { char l,m,g,h; int t,i,j,k,r; scanf("%d%*c",&t); while(t--) { gets(s1); gets(s2); l=strlen(s1); m=strlen(s2); if(l==m) { g=0,h=0; for(k=0;k<l;k++) {...
#include <bits/stdc++.h> using namespace std; int main() { char s[10009]; float sq; int k,len,num,i,j,temp; cin>>num; while(num--) { scanf("\r"); gets(s); len=strlen(s); sq=sqrt(len); int p=(int)sq; char ch[p][p]; if(p == sq) { int n=0;...
#include <stdio.h> #include <string.h> int main() { char s1[500],s2[500],s1s[500],s2s[500]; int t,i,j,k; scanf("%d ",&t); for(i=0;i<t;i++){ gets(s1); gets(s2); if(strcmp(s1,s2)==0)printf("Case %d: Yes\n",i+1); else { k=0;...
#include <bits/stdc++.h> using namespace std; int main() { int tc,n,c,a[51],i; cin>>tc; for(int j=1;j<=tc;j++) { cin>>n; int h=0; int l=0; for(i=0;i<n;i++) cin>>a[i]; for(i=0;i<n-1;i++) { if(a[i+1]>a[i]) { h++; } else...
#include <bits/stdc++.h> using namespace std; int main() { int t1,t2,f,a,ct1,ct2,ct3,sum,avr,c,t; cin>>t; for(c=0;c<t;c++) { sum=0; cin>>t1>>t2>>f>>a>>ct1>>ct2>>ct3; { if(ct1<=ct2 &&...
#include <bits/stdc++.h> using namespace std; int main() { int e,a; while(cin>>a) { if(a==0) break; e=0; while(a>=3) { a=a-3; e++; a++; } if(a==2) { cout<<e+1<<endl; } else cout<<e<<endl; } return 0; }...
#include<bits/stdc++.h> using namespace std; int main() { int n,k,p,result,tc,i,j,c=0; while(cin>>tc) { while(tc--) { cin>>n>>k>>p; result=k+p; while(result>n) { result-=n; } printf("Case %d: %d\n",c+1,result); c++; } } return...
#include <bits/stdc++.h> using namespace std; int main() { int n, array[10], c, d, t; while(cin>>array[0]>>array[1]>>array[2]) { if(array[0]==0 and array[1]==0 and array[2]==0) break; for (c = 0 ; c <= 2; c++) { d = c; while (...
#include <bits/stdc++.h> using namespace std; char input[1050]; int main() { int i,j,l,rem,total; while(1) { l=strlen(gets(input)); rem=0; if(l==1 and input[0]=='0') break; for(i=0;i<l;i++) { total=rem*10 + (input[i] - '0'); rem=total%17;...
#include<bits/stdc++.h> using namespace std; int main() { int tc,n,p,q,b,i,j,a[30],sum,sr=1,egg,wt; while(cin>>tc) { for(j=1;j<=tc;j++) { cin>>n>>p>>q; for(i=0;i<n;i++) { cin>>a[i]; } egg=0,wt=0; for(i=0;i<n;i++) {...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int tc=1; while(n--) { int input; cin>>input; map<string,int>m; string s; int d; for(int i=1;i<=input;i++) { cin>>s>>d; m[s]=d; } int D;...
#include <bits/stdc++.h> using namespace std; int main() { unsigned long int d,q; int i,count,j,bn[1000]; while(scanf("%lu",&d)==1) { if(d==0) break; i=0; q=d; while(q!=0) { bn[i++]= q%2; q/=2; } count=0; printf("The parity of ");...
#include <bits/stdc++.h> using namespace std; int main() { int a,b,c,d,l,fn,count; while(cin>>a>>b>>c>>d>>l) { if(a==0 and b==0 and c==0 and d==0 and l==0) break; count=0; for(int i=0;i<=l;i++) { fn=a*i*i + b*i +c;...
#include <bits/stdc++.h> using namespace std; int main() { int tc,a,b,c; cin>>tc; while( tc-- ) { cin>>a>>b>>c; if( a+b>c and b+c>a and c+a>b) cout<<"OK"<<endl; else cout<<"Wrong!!"<<endl; }...
Ready to leverage AI in your development lifecycle? Our 2025 C-level guide covers strategic implementation, process tuning, and managing expectations for real ROI.
Unlock next-level efficiency with AI workflow automation. Discover the best tools to streamline processes, reduce errors, and empower your team to innovate.
Discover the top AI tools that actually boost business ROI. Our guide covers the best AI software for marketing, sales, and productivity to drive real growth.
Discover how Amazon’s new generative AI agent is revolutionizing e-commerce by automating listings, enhancing descriptions, and boosting sales for sellers.