#include <bits/stdc++.h> using namespace std; int main() { long long s,d,size,sum; while(cin>>s>>d) { sum=0; for(size=s;size<=d;size++) { sum=sum+size; if(sum>=d) { printf("%lld\n",size); break; } } } return 0; }...
UVA Problem 10171(Meeting Prof Miguel) Solution
#include <bits/stdc++.h> using namespace std; int main() { long long s,d,size,sum; while(cin>>s>>d) { sum=0; for(size=s;size<=d;size++) { sum=sum+size; if(sum>=d) { printf("%lld\n",size); break; } } } return 0; }...
UVA Problem 10195(The Knights Of The Round Table) Solution
#include <bits/stdc++.h> using namespace std; int main() { double a,b,c; double S,A,R; while(cin>>a>>b>>c) { S=(a+b+c)/2; if(S==0) { printf("The radius of the round table is: 0.000\n"); } else { A=S*(S-a)*(S-b)*(S-c); R=sqrt(A)/S; printf("The...
UVA Problem 10222 (Decode the Mad Man solution |) Solution
#include<bits/stdc++.h> using namespace std; int main() { string s,sum; int i,l; getline(cin,s); { l=s.size(); for( i=0;i<l;i++) { if(s[i]=='a' || s[i]=='A') { sum+='['; } else if(s[i]=='b' || s[i]=='B') { sum+='c'; } else if(s[i]=='c' || s[i]=='C') {...
UVA Problem 10260( Soundex Solution) Solution
#include<bits/stdc++.h> using namespace std; int main() { char s[120]; int l,i; while(gets(s)) { l=strlen(s); for(i=0;i<l;i++) { if(s[i]=='B' || s[i]=='F' || s[i]=='P' || s[i]=='V') { if(s[i+1]!='B' && s[i+1]!='F' && s[i+1]!='P' &&...
UVA Problem 10300( Ecological Premium) Solution
#include <bits/stdc++.h> using namespace std; int main() { int n,a[26],b[26],c[26],i,j,farm,ans; cin>>n; while(n--) { cin>>farm; ans=0; for(i=0;i<farm;i++) { cin>>a[i]>>b[i]>>c[i]; ans+=a[i]*c[i]; } cout<<ans<<endl; }...
UVA Problem 10302 Solution
#include <bits/stdc++.h> using namespace std; int main() { long long int k,sum,i,j; while(scanf("%lld",&k)==1 && k) { sum=(k*k*(k+1)*(k+1))/4; printf("%lld\n",sum); } return 0; }
UVA Problem 10324(Zero’s and One’s) Solution
#include<stdio.h> #include<string.h> #include<iostream> using namespace std; char s[1000003]; int main() { long int len,i,j,t,min,max,tc=0,temp,op=1; while(cin>>s) { len=strlen(s); if(len==0) break; cin>>t; { for(i=0;i<t;i++) {...
UVA Problem 10325 (The Lottery) Solution
#include <bits/stdc++.h> using namespace std; int check_prime (long int n) { int i; for ( i = 2; i * i <= n; i++) { if (n % i == 0) return 0; } return 1; } int rev(int n) { int reverse=0, rem; while(n) { rem=n%10; reverse=reverse*10+rem; n/=10; } return...
UVA Problem 10327 (Flip Sort) Solution
#include <bits/stdc++.h> using namespace std; int main() { int n, array[5000],k, c,count,d,T, t; while(scanf("%d",&n)==1) { count=0; for (c = 0; c < n; c++) { cin>>array[c]; } for (c = 1 ; c <= n - 1; c++) { d = c; while ( d > 0 &&...
UVA Problem 10346 ( Peter’s Smokes) Solution
#include<stdio.h> int main() { int smoke,n,k; while(scanf("%d %d",&n,&k)==2 && k>1) { do { smoke=n; smoke=smoke+(n/k); n=(n/k)+(n%k); printf("%d\n",smoke); } while(n>=k); } return 0; }
UVA Problem 10365(Blocks) Solution
#include <bits/stdc++.h> using namespace std; int main() { int n,i,j,k,l,h,w,area,surface_area,tc; cin>>tc; while( tc-- ) { cin>>n; area=1000000; for(l=1;l<=n;l++) for(h=1;h<=sqrt(n);h++) for(w=1;w<=sqrt(n);w++) { if(l*h*w==n)//if it a cube...
UVA Problem 10370 (Above Average) Solution
#include <stdio.h> #include <math.h> int a[2000]; int main() { int t,n,i,j,sum,count,avg,ans; scanf("%d",&t); while(t--) { sum=0,count=0; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); } for(i=0;i<n;i++) { sum+=a[i]; } avg=sum/n;...
UVA Problem 10394 (Twin Prims) Solution
#include <stdio.h> #include<iostream> #include<math.h> using namespace std; bool flag[20000005]; int primes[20000000]; int tprimes[20000000]; int cnt,m=0; void sieve(int n) { cnt=0; primes[cnt++]=2; for(int i=3; i<=n; i+=2) { if(flag[i] == 0) {...
UVA Problem 10424 (Love Calculator) Solution
#include <stdio.h> #include <iostream> #include <string.h> using namespace std; int main() { char s[100],len; int i,j,op,d,sum,ip=0,ip1,ip2; float result; while(gets(s)) { ip++; sum=0; len=strlen(s); for(i=0;i<len;i++) { if(s[i]=='a' || s[i]=='A')...
UVA Problem 10432 (Polygon Inside A Circle) Solution
#include <bits/stdc++.h> using namespace std; #define PI 2*acos(0.0) int main() { double r ,n,a,ans; while(scanf("%lf %lf",&r,&n)==2) { a=(r*r*sin(2*PI/n))/2; ans=n*a; printf("%.3lf\n",ans); } return 0; }...
UVA Problem 10469 (To Carry or not to Carry) Solution
#include<stdio.h> int main() { unsigned long a,b; while(scanf("%lu %lu",&a,&b)==2) { printf("%lu\n",a^b); } return 0; }
UVA Problem 10487(Closest Sum) Solution
#include <stdio.h> int main() { int n, i, q, c, sz, idx, idx2, t1, t2, elteres, ce = 0; while(1) { scanf("%d",&n); if(!n) break; printf("Case %d:\n",++ce); int set[n], i = 0, q = 0; sz = n; while(n--) { scanf("%d",&set[i++]); } scanf("%d",&q);...
UVA Problem 10490 ( Mr. Azad and his Son) Solution
#include<iostream> #include<cstdio> #include<cmath> using namespace std; int main() { int n; int prime[] = {2,3,5,7,11,13,17,19,23,29,31}; int sum,i,j,count; while(scanf("%d",&n)==1) { if(n==0) break; count =0; for(i=0; i<11; i++) {...
UVA Problem 10499 (The Land of Justice ) Solution
#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; }...
Unlocking the PHP Ecosystem: Your Essential Weekly Guide to News, Trends, and Updates
Stay ahead in web development with a weekly dive into PHP news, articles, events, and essential links. Discover the power of continuous learning for PHP professionals.
Mastering the IELTS Speaking Test: Your Comprehensive Guide to an Impressive Score
Discover expert strategies and essential resources to ace the IELTS Speaking Test. Learn how to boost your fluency, vocabulary, and confidence for a top score.
Unveiling Java 25: A Deep Dive into the September 2025 Inside Java Newsletter
Get ready for Java 25! The September 2025 Inside Java Newsletter is packed with technical videos, Java User Group updates, and essential developer event news. Stay ahead with the latest Java innovations.
AI in Education: Navigating ChatGPT’s Dual Impact on Learning and Application Essays
Explore how AI tools like ChatGPT are reshaping education, from aiding learning to challenging academic integrity, especially in the realm of college application essays.




