#include <bits/stdc++.h> using namespace std; int main() { long int r ,a; while(scanf("%ld",&r)==1) { if(r<0) break; if(r==0) printf("0%\n"); else if(r==1) printf("0%\n"); else if(r>=2) { a=r*25; printf("%ld%%\n",a); } } return 0; }...
UVA Problem 10591 Solution
#include<bits/stdc++.h> using namespace std; int main() { int i,j,k,d,sum,num,tc,n,ans,digit; while(cin>>tc) { for(k=1;k<=tc;k++) { cin>>n; num=n,ans=0; while(n>9) { while(n!=0) { digit=n%10; n/=10; ans+=digit*digit; } n=ans; ans=0; }...
UVA Problem 10633 Solution
#include<bits/stdc++.h> using namespace std; int main() { unsigned long long n,N; while(cin>>n and n>0) { N=(n*10)/9; if(n%9==0) { cout<<N-1<<" "<<N<<endl; } else { cout<<N<<endl; } } return 0; }...
UVA Problem 10656 Solution
#include <bits/stdc++.h> using namespace std; int a[10000]; int main() { int n,t,i,j; while(scanf("%d",&t)==1) { j=0; if(t==0) return 0; for(i=0;i<t;i++) { scanf("%d",&a[i]); if(a[i] > 0) { j++; a[n++]=a[i]; } } for(i=0;i<n;i++) { if(j==1)...
UVA Problem 10696 Solution
#include <stdio.h> int main() { int n; while((scanf("%d",&n)==1) && n!=0) { if(n>=101) printf("f91(%d) = %d\n",n,n-10); else printf("f91(%d) = 91\n",n); } return 0; }
UVA Problem 10699 Solution
#include<bits/stdc++.h> bool flag[1000005]; int List[1000005],primes[100000]; int listSize,cnt; 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; if(i <= n/i) { for(int...
UVA Problem 10734 Solution
#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 Problem 10773 Solution
#include<bits/stdc++.h> using namespace std; int main(){ double d,v,u,t1,t2; int t; cin>>t; for(int i=0;i<t;i++){ cin>>d>>v>>u; if( u==0 || v==0 || v>=u ){ printf("Case %d: can't determine\n",i+1); continue; } t1=d/u;...
UVA Problem 10783 Solution
#include <stdio.h> int main() { int t,a,b,i,j=1,sum; scanf("%d",&t); while( t-- ) { sum = 0; scanf("%d %d",&a,&b); for( i=a ; i<=b ; i++) { if(i%2==1) sum += i; } printf("Case %d: %d\n",j,sum); j++; } return 0; }...
UVA Problem 10784 Solution
#include <bits/stdc++.h> using namespace std; int main() { double N,n; int c=1; //long int n; while(cin>>N and N!=0) { n=ceil((sqrt(8*N + 9)+ 3)/2); printf("Case %d: %.lf\n",c++,n); } return 0; }...
UVA Problem 10790 Solution
#include<bits/stdc++.h> using namespace std; int main() { long long int a,b,i=1; while(cin>>a>>b) { if(a==0 && b==0) break; if(a==0 || b==0) { printf("Case %lld: 0\n",i); continue ; } printf("Case %lld: %lld\n",i++,((a*b*(a-1)*(b-1))/4)); }...
UVA Problem 10852 Solution
#include <stdio.h> #include<iostream> #include<math.h> #define MAX 10001 using namespace std; bool flag[MAX]; int primes[MAX]; int cnt; 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 10880 Solution
#include <iostream> #include <algorithm> #include <set> #include <cmath> using namespace std; int main(void) { int tc, c, r,t,q; set<int> v; set<int>::iterator it; cin >> tc; for (t = 0; t < tc; t++) { cin >> c...
UVA Problem 10921 ( Find the Telephone) Solution
#include <bits/stdc++.h> using namespace std; int main() { char s[200],c; int i,l,j; while(gets(s)) { l=strlen(s); for(i=0;i<l;i++) { if(s[i]=='A' ||s[i]=='B' ||s[i]=='C' ) printf("2"); else if(s[i]=='D' ||s[i]=='E' ||s[i]=='F' ) printf("3"); else...
UVA Problem 10922 (The 9s) Solution
#include <bits/stdc++.h> using namespace std; char in[1002]; int main() { int j,i,count,sum,totat,digit,deg,l,q,d; bool flag; while(1) { flag=true; sum=0; l=strlen(gets(in)); if(l==1 && in[0]=='0')return 0; for(i=0;i<l;i++) sum+=in[i]-'0';...
UVA Problem 10924 (Prime Words ) Solution
#include <iostream> #include <string.h> using namespace std; int main() { char s[150]; int i,j,total,result,l; while(gets(s)) { total=0; l=strlen(s); for(i=0;i<l;i++) { switch(s[i]) { case 'a': total=total+1; break; case 'b': total=total+2; break; case...
UVA Problem 10929 (You can say 11) Solution
#include <bits/stdc++.h> using namespace std; int main() { char input[1002]; int i,j,l,sum; while(1) { gets(input); sum=0; l=strlen(input); if(input[0]=='0' and l==1) break; for(i=0;i<l;i+=2) { sum+=input[i]-'0'; } for(i=1;i<l;i+=2) { sum-=input[i]-'0'; }...
UVA Problem 10948( The primary problem) Solution
#include <stdio.h> #include<iostream> #include<math.h> #define max 1000005 using namespace std; bool flag[max]; int primes[max]; int cnt; int sieve(int z) { int i,j; for(i=2; i<=max; i++) { primes[i]=1; } for(i=2; i<=sqrt(max); i++) { for(j=2;...
UVA Problem 11000(Bee) Solution
#include <bits/stdc++.h> using namespace std; int main() { long int temp,male,female,total,y; int i; while(cin>>y && y>=0) { male=0,female=1; for( i=0;i<y;i++) { temp=male; male=female+temp; female=temp+1; } cout<<male<<"...
UVA Problem 11044( Searching for Nessy) Solution
#include <bits/stdc++.h> using namespace std; int main() { int n,m,i,j,k,l,a,b,ans; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d %d",&a,&b); cout<<( (a/3) * (b/3) )<<endl; } return 0; }...
Decoding Tomorrow: Exploring the Latest Technology Breakthroughs and Scientific Research
Dive into the forefront of innovation with insights into nanotechnology, biotechnology, green tech, and other groundbreaking scientific research shaping our future.
Python in 2025: Unlock Web Development’s Full Potential with Modern Versions
A 2025 survey reveals 83% of developers use outdated Python. Discover why upgrading to modern Python is critical for web development performance, security, and innovation.
Unlocking Innovation: A Comprehensive Guide to Essential AI Tools for 2024
Dive into the world of AI tools with our comprehensive guide. Explore categories, benefits, and top applications transforming industries and daily life in 2024.
PHP 8.5: Unpacking the Future of Web Development (Release, Features & Migration Guide)
Get ready for PHP 8.5, scheduled for release on November 20, 2025! Explore the upcoming features, performance boosts, and essential migration strategies for a smoother transition.




