#include <bits/stdc++.h> int main() { char s[105]; while(gets(s)) { printf("%s",s); } return 0; }
UVA Problem 10168 Solution
#include <stdio.h> #define N 10000000 typedef long long LL; using namespace std ; LL primes[N]; //bool flag[N]; void sieve(LL n) { for(LL i=4; i<=n; i+=2) { primes[i]=1; } //LL p=(LL)sqrt(n); for(LL i=3; i*i<=n; i+=2) { if(primes[i]) continue;...
UVA Problem 10340 (All in All) Solution
#include <bits/stdc++.h> using namespace std; char s[100000],t[100000]; int main() { int i,j; bool flag; while(scanf("%s %s",s,t)!=EOF) { flag=false; for(j=0,i=0;t[i]!='\0';i++) { if (s[j] == t[i]) j++; if (s[j] == '\0') { flag = true; break; } }...
UVA Problem 10550 (Combination Lock) Solution
#include <bits/stdc++.h> using namespace std; int main() { int a,b,c,d,res; while(cin>>a>>b>>c>>d) { if(a==0 and b==0 and c==0 and d==0) break; res=1080; res += (a > b) ? (a - b) * 9 : (a - b + 40) * 9; res += (c > b) ? (c - b) * 9...
UVA Problem 10976 (Fractions Again) Solution
#include <bits/stdc++.h> using namespace std; int main() { int x,y,k,n,i,KK,X[10005],Y[10005]; bool f; KK=0; while(cin>>k) { KK=0; //X[105]=Y[105]={0}; memset(X, 0, sizeof(X[0]) * 10005); memset(Y, 0, sizeof(Y[0]) * 10005); for(y= 2*k ; y!=k;...
UVA Problem 11286 ( Conformity) Solution
#include <bits/stdc++.h> #include <algorithm> #include <vector> #include <map> #include <iostream> using namespace std; #define SIZE(a) ((int)a.size()) #define FOREACH(i, c) for (__typeof((c).begin()) i = (c).begin(); i !=...
UVA Problem 11364 ( Parking) Solution
#include <bits/stdc++.h> using namespace std; int main() { int a[150],i,j,tc,n,sum; cin>>tc; while(tc--) { sum=0; cin>>n; for(i=0;i<n;i++) cin>>a[i]; sort(a,a+n); for(i=0;i<n-1;i++) sum+=abs(a[i]-a[i+1]); sum*=2;...
UVA Problem 12015 ( Google is Feeling Lucky) Solution
#include <bits/stdc++.h> using namespace std; int main ( ) { char arr[101],a[101], b[101],c[101],d[101], e[101],f[101],g[101], h[101],in[101], jn[101]; int val,i, tc,cases = 1 ; cin>>tc; while (tc--) { scanf ( "%s %d" , a ,&arr[0]); scanf ( "%s...
UVA Problem 12250 ( Language Detection) Solution
#include <bits/stdc++.h> using namespace std; int main() { char s[2001]; int cases=1,l; while(scanf("%s",s)) { if(strcmp(s,"#")==0) break; if(strcmp(s,"HELLO")==0) printf("Case %d: ENGLISH\n",cases++); else if(strcmp(s,"HOLA")==0) printf("Case %d:...
UVA Problem 12279 ( Emoogle Balance) Solution
#include <bits/stdc++.h> using namespace std; int main() { int tc,cases=1,n,a[1001],give,given,egl; while(cin>>n) { give=0,given=0; if (n==0) break; for(int i=0;i<n;i++) cin>>a[i]; for(int i=0;i<n;i++) if(a[i]==0) give++; else...
UVA Problem 12289 ( One-Two-Three) Solution
#include <bits/stdc++.h> using namespace std; int main() { char s[101],l; int i,tc,ans; cin>>tc; while(tc--) { scanf("%s",s); l=strlen(s); if(l<=3) { if(s[0] =='o'&&s[1]=='n'&& s[2] == 'e' || s[0] == 'o' && s[1] == 'n' ||...
UVA Problem 12403 ( Save Setu ) Solution
#include <bits/stdc++.h> using namespace std; int main() { char s[150]; int tc,a,sum=0,amount; cin>>tc; while(tc--) { scanf("\r"); scanf("%s",s); if(strcmp(s,"donate")== 0) { cin>>amount; sum+=amount; //printf("%d\n",sum); } else...
UVA Problem 12468 ( Zapping) Solution
#include <bits/stdc++.h> using namespace std; int main() { int a,b,ans; while(cin >> a >> b) { if(a==-1 and b==-1) break; ans=abs(a-b); if(ans>50) ans=100-ans; cout<<ans<<endl; } return 0; }...
UVA Problem 12577( Hajj-e-Akbar) Solution
#include <bits/stdc++.h> using namespace std; int main() { char s[10]; int cases=1; while(scanf("%s",s)) { if(strcmp(s,"*")==0) break; else if( strcmp(s,"Hajj")== 0) printf("Case %d: Hajj-e-Akbar\n",cases++); else printf("Case %d:...
UVA Problem 336 (A Node Too Far) Solution
#include<bits/stdc++.h> using namespace std; int tc=1,position=0; int bfs(int src, int TTL,map <int, vector<int> > edges) { map<int,int> visited,level; int unreach=0; queue<int>Q; Q.push(src); position=1; visited[src]=1;...
UVA Problem 10004 (Bicoloring) Solution
#include <cstdio> #include <vector> #include <queue> using namespace std; typedef vector<int> vi; int main() { int V, E, u, v; vector<vi> AdjList; while (scanf("%d", &V), V) { AdjList.assign(V, vi()); scanf("%d",...
UVA Problem 490 (Rotating Sentences ) Solution
#include <bits/stdc++.h> #include <string> #include <vector> #include <map> using namespace std; int main() { string s; int frequency=0; vector<string>vec; while(getline(cin,s)) { v.push_back(s); frequency=max(frequency,(int)s.length());...
UVA Problem 496 ( Simply Subsets )Solution
#include <iostream> #include <string> #include <sstream> #include <vector> using namespace std; int main() { stringstream ss; string line1,line2; vector<int>A,B; int i,j,ch; while(getline(cin,line1) && getline(cin,line2)) {...
UVA Problem 499( What’s The Frequency, Kenneth) Solution
#include <bits/stdc++.h> #include <string.h> #include <map> using namespace std; int main() { string s; //map<char,int>m; // map<char,int>::iterator it; while(getline(cin,s)) { map<char,int>m; int mxfrq=0; int len=s.size(); for(int...
UVA Problem 455 Periodic Strings Solution
#include <bits/stdc++.h> using namespace std; int main() { char s[140],charcter,l; int i,j; while(gets(s)) { for(i=0; s[i] != '\0'; ) { int freq = 0; while( (s[i] >='0' && s[i] <='9') ) { charcter = ( s[i++]-'0' ); freq += charcter;...
Enhancing the Java Developer Experience: Unlocking the Potential of Build Tools
Dive into the world of Java build tools like Maven and Gradle. Discover how to optimize your build process for speed, safety, and a superior developer experience.
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.
Mastering IELTS Speaking: Your Daily English Practice Roadmap for Success
Unlock a higher IELTS Speaking score with a consistent daily English practice routine. Discover expert tips and actionable strategies to boost your fluency, vocabulary, and confidence for test day.
Anticipating Python 3.14: Features, Performance & Data Science Trends for 2025
Get an early look at Python 3.14, slated for 2025! Explore expected features, performance boosts, and how it will shape Python development and data science.




