#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; }...
UVA Problem 11644 Solution – Pyragrid
#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; }...
UVA Problem 11650 Solution – Mirror Clock
#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;...
UVa Solution 11677: Alarm Clock
#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;...
UVA Problem 11689 Solution – Soda Surpler
#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; }...
UVA Problem 11713 Solution – Abstract Names
#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++) {...
UVA Problem 11716 Solution – Digital Fortress Solution
#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;...
UVA Problem 11734 Solution- Big Number of Teams will Solve This
#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;...
UVa 11764 Solution – Jumping Mario
#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...
UVA Problem 11777 Solution – Automate the Grades
#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 &&...
UVA Problem 11778 Solution – Graph Coloring
#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; }...
Uva 11805 Solution – Bafana Bafana
#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...
UVA Problem 11854 Solution – Egypt
#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 (...
Uva 11879 Solution – Multiple of 17
#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;...
Uva 11900 Solution– Boiled Eggs
#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++) {...
UVa : 11917 (Do Your Own Homework!)
#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;...
UVa 11931 Solution- Maze Escape
#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 ");...
Uva 11934 Solution – Magic Formula
#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;...
Uva 11936 solution – The Lazy Lumberjacks
#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; }...
UVA Problem 11942 Solution – Lumberjack Sequencing
#include<bits/stdc++.h> using namespace std; int main() { int tc,a[13]; scanf ("%d", &tc); printf ("Lumberjacks:\n"); while ( tc-- ) { for ( int i = 0; i < 10; i++ ) { scanf ("%d", &a [i]); } bool flag = true; if (a [0] > a [1]) flag =...
Mastering the IELTS: Why Recent Exam Questions Are Your Secret Weapon
Unlock your potential in the IELTS exam! Discover how leveraging recent exam questions can sharpen your skills, build confidence, and boost your score.
Laravel: The PHP Framework Powering Modern Web Applications
Discover Laravel, the open-source PHP framework renowned for its elegant syntax, robust features, and security, making web development enjoyable and efficient.
Unlocking Modern Web Development: Why Laravel is the PHP Framework You Need
Discover Laravel, the open-source PHP framework that combines elegant syntax with robust tools for building secure, scalable, and enjoyable web applications. Learn its core strengths.
Django vs. FastAPI in 2024: Choosing Your Python Web Framework for the Future
Comparing Django and FastAPI for modern web development needs. Discover which Python framework excels in performance, development speed, and scalability for your next project.



