UVA Problem 11057 (Exact Sum) Solution

UVA Problem 11057 (Exact Sum) Solution

#include <bits/stdc++.h> using namespace std; int main() { int v[10010]; //vector<int>v; int i,j,n,k,max,price1,a,price2,m,diff,tmp; while(cin>>n) { for(i=0;i<n;i++) cin>>v[i]; //v.push_back(i); cin>>m; max=1000000;...

UVA Problem 11152 Solution

UVA Problem 11152 Solution

#include <bits/stdc++.h> #define pi 2*acos(0) using namespace std; int main() { double s,a,b,c,tri_area,red_out,red_in; double area_circum,area_inscribed,area_triangle; while(scanf("%lf %lf %lf", &a, &b, &c)==3) { s=(a+b+c)/2;...

UVA Problem 11185 Solution

UVA Problem 11185 Solution

#include <stdio.h> int main() { long int dn,r,q; long int bn[10000],i,j; while(1) { scanf("%ld",&dn); if(dn<0) break; else if(dn==0) printf("0\n"); else { q=dn; i=0; while(q>0) { bn[i++]=q%3; q=q/3; } i=i-1; for(j=i;j>=0;j--) printf("%ld",bn[j]);...

UVa Problem 11192  Solution – Group Reverse

UVa Problem 11192 Solution – Group Reverse

  #include <bits/stdc++.h> using namespace std; int main() { char s[200]; int n,i,j,l,a; while(cin>>n) { if(n==0) break; scanf("%s",s); l=strlen(s); a=l/n; for(i = 0; i < l; i += a) { for(j = i+a-1; j >= i; j--) printf("%c",s[j]); } puts(""); }...

UVA Problem 11233 Solution – Deli Deli

UVA Problem 11233 Solution – Deli Deli

  #include <bits/stdc++.h> using namespace std; int main() { string ch1,ch2; map<string,string>m; int n,l,i,j,k; char c1,c2; cin>>l>>n; for(i=0;i<l;i++) { cin>>ch1>>ch2; m[ch1]=ch2; } for(i=0;i<n;i++){ cin>>ch2;...

UVA Problem 11332 Solution – Summing Digits

UVA Problem 11332 Solution – Summing Digits

    #include <bits/stdc++.h> using namespace std; int func_tion(int n) { int j,sum=0; if(n<10) return n; else { for(j=0;; j++) { sum+=n%10; n=n/10; if(n==0) break; } return func_tion(sum); } } int main() { int a,n,res,sum,k; while(cin>>n...

UVA Problem 11340 Solution – Newspaper

UVA Problem 11340 Solution – Newspaper

    #include<stdio.h> #include<math.h> #include<string.h> #include<iostream> using namespace std; char ch1[10002]; int main() { int n,k,m,value[102],nn; char ch[302]; double s; scanf("%d",&n); while(n--) { s=0;...

UVA Problem 11344 Solution  – The Huge One

UVA Problem 11344 Solution – The Huge One

    #include <bits/stdc++.h> using namespace std; int main() { char m[1002]; int tc, l, n, i, j, r,sum,a[100]; bool flag; cin>>tc; while (tc--) { scanf("\r"); gets(m); l = strlen(m); cin>>n; for (i = 0; i < n; i++) cin>>a[i]; flag...

UVA Problem 11428 Solution – Cubes

UVA Problem 11428 Solution – Cubes

    #include <bits/stdc++.h> using namespace std; int main() { int n,a,b,i,j,x,y; bool penalty; while(cin>>n) { if(n==0) break; penalty=false; for(i=1;i<n;i++) { for(j=0;j<=i;j++) { if((i*i*i-j*j*j)==n) { cout<<i<<"...

UVA Problem 11462 Solution – Age sort

UVA Problem 11462 Solution – Age sort

  #include <bits/stdc++.h> using namespace std; long int ary[2000007]; int main() { int n,i,j,k; while (scanf("%ld",&n)==1) { if (n==0) { break; } for (i=0;i<n;i++) { scanf("%ld",&ary[i]); } sort(ary,ary+n); for (i=0;i<n;i++) {...

UVA Problem 11494 Solution – Queen

UVA Problem 11494 Solution – Queen

    #include <bits/stdc++.h> using namespace std; int main() { int x1,x2,y1,y2; while(cin>>x1>>y1>>x2>>y2) { if(x1==0 && y1==0 && x2==0 && y2==0) break; if(x1==x2 and y1==y2) printf("0\n"); else if(...

UVA Problem Solution11541 – Decoding

UVA Problem Solution11541 – Decoding

    #include <bits/stdc++.h> using namespace std; int main() { int tc,cases=0,j,r; char s[1000],c; cin>>tc; while(tc--) { scanf("\r"); gets(s); int l=strlen(s); printf("Case %d: ",++cases); for(int i=0;i<l;i++) { r=0;...

struct and union in C

struct and union in C

  struct and union in C These both declare same and uses are almost same; just the difference when use struct then need to declare with ‘struct’ keyword struct student { int roll; float age; }; when use union then declare as union student { int roll; float age;...

Cambridge IELTS 15 Reading Test 3 Answers

Cambridge IELTS 15 Reading Test 3 Answers

PASSAGE 1: HENRY MOORE (1898 – 1986 ) QUESTIONS 1-7: DO THE FOLLOWING STATEMENTS AGREE WITH THE INFORMATION GIVEN IN READING PASSAGE 1? 1. Answer: TRUE Key words: leaving school, Moore, did, father, wanted It is mentioned in the first paragraph...

Cambridge IELTS 15 Reading Test 2 Answers 

Cambridge IELTS 15 Reading Test 2 Answers 

PASSAGE 1: COULD URBAN ENGINEERS LEARN FROM DANCE ?  QUESTIONS 1- 6: READING PASSAGE 1 HAS SEVEN PARAGRAPHS, A-G. 1. Answer: B Key words: way of using dance, not proposing By using the skimming and scanning technique, we would find that before...

CAMBRIDGE IELTS 14 READING TEST 4 ANSWERS 

CAMBRIDGE IELTS 14 READING TEST 4 ANSWERS 

PASSAGE 1: THE SECRET OF STAYING YOUNG QUESTIONS 1-8: COMPLETE THE NOTES BELOW. 1. ANSWER: FOUR / 4 Explain– Key words: focused age groups, ants– In paragraph 3, it is stated that “Giraldo focused on ants at four age ranges”,so the answer must be “four/4”....

CAMBRIDGE IELTS 14 READING TEST 3 ANSWERS

CAMBRIDGE IELTS 14 READING TEST 3 ANSWERS

PASSAGE 1: THE CONCEPT OF INTELLIGENCE QUESTIONS 1-3: READING PASSAGE 1 HAS SIX PARAGRAPHS, A-F. 1. ANSWER: B Explain ·     Key words: non-scientists, assumptions, intelligence, influence, behavior ·    People‟s behavior towards...