UVA Problem 264 Count on Cantor  Solution

UVA Problem 264 Count on Cantor Solution

    #include <bits/stdc++.h> using namespace std; int main() { int N,i,j,insum,line; while(cin>>N) { insum=0; for(i=0;;i++) { insum+=i; if(insum >= N) { line = i; break; } } printf("TERM %d IS ", N); if(line&1)//insum-line...

UVA Problem 10189 Minesweeper Solution

UVA Problem 10189 Minesweeper Solution

  #include <bits/stdc++.h> using namespace std; int main () { int n,m; int count=0; while(1) { cin>> m >> n; if (n ==0 && m ==0) break; count++; if (count > 1) cout << '\n'; int board[102][102] = {0}; for (int i=1; i<m+1;...

UVA Problem 12157  Tariff Plan Solution

UVA Problem 12157 Tariff Plan Solution

    #include <stdio.h> #include <bits/stdc++.h> using namespace std; int main() { int a,miles,juice,n,T,tc=1,b,c,i,arr,m,j,cells; cin>>T; for(int i=0;i<T;i++){ cin>>n; miles=0,juice=0; while(n--) { cin>>cells; miles...

UVA Problem 123 Searching Quickly Solution

UVA Problem 123 Searching Quickly Solution

    #include <bits/stdc++.h> using namespace std; long long int reverse(long long int n) { long long int sum=0,r; while(n > 0) { r=n%10; sum=sum*10+r; n=n/10; } return sum; } int main() { long long int t, sum, count; int cse; cin >> cse; for...

UVA Problem 272  TEX Quotes Solution

UVA Problem 272 TEX Quotes Solution

  #include <bits/stdc++.h> using namespace std; char s[200000]; int main() { int c=0,i; while(gets(s)) { for(i=0;i<strlen(s);i++) { if(s[i]=='"') { c++; if(c/2==0) printf("``"); else printf("''"); } else printf("%c",s[i]);; } printf("\n"); } return 0; }...

UVA Problem 299 train swap Solution

UVA Problem 299 train swap Solution

  #include <bits/stdc++.h> using namespace std; int main() { int n, array[5000],k, c,count,d,T, t; while(cin>>T) { for(k=0;k<T;k++) { cin>>n; count=0; for (c = 0; c < n; c++) { cin>>array[c]; } for (c = 1 ; c <= n - 1; c++) { d =...

UVA problem 386  Perfect Cubes solution

UVA problem 386 Perfect Cubes solution

    #include <bits/stdc++.h> using namespace std; int main() { int a,b,c,d,n,i,j,k; for(n=6;n<=200;n++) { int a=n*n*n; for(i=2;i<=200;i++) { int b=i*i*i; for( j=i;j<n;j++) { int c = j*j*j; for( k=j;k<n;k++) { int d = k*k*k; if(a==(b+c+d)) {...

UVA Problem 406  Prime Cuts Solution

UVA Problem 406 Prime Cuts Solution

    #include <stdio.h> #include<iostream> using namespace std; bool flag[1005]; int primes[1005]; int cnt; void seive(int n) { cnt=0; primes[cnt++] = 1; primes[cnt++]=2; for(int i=3; i<=n; i+=2) { if(flag[i] == 0) { primes[cnt++] = i; if(i...

UVA Problem 483( Word Scramble) Solution

UVA Problem 483( Word Scramble) Solution

    #include<stdio.h> #include<string.h> int main() { int l,i,j,b,k; char n[1000]; while(gets(n)) { l=strlen(n); b=-1; for(i=0;i<l;i++) { if(n[i]==' ') { for(j=i-1;j>b;j--) printf("%c",n[j]); printf(" "); b=i; } } for(i=l-1;i>b;i--)...

UVA Problem 492  Pig-Latin Solution

UVA Problem 492 Pig-Latin Solution

    #include<bits/stdc++.h> using namespace std; bool vowel(char ch) { if (ch == 'a' || ch == 'A' || ch == 'e' || ch == 'E' || ch == 'i' || ch == 'I' || ch =='o' || ch=='O' || ch == 'u' || ch == 'U') return true; else return false; } int main() { char...

UVA Problem 543  Goldbach’s Conjecture Solution

UVA Problem 543 Goldbach’s Conjecture Solution

#include <stdio.h> #include<iostream> #include<math.h> using namespace std; int primes[]={2,3 ,5, 7, 11, 13, 17, 19, 23 ,29 ,31 ,37, 41, 43, 47 ,53 ,59 ,61, 67, 71, 73, 79, 83, 89, 97 ,101, 103, 107, 109, 113, 127 ,131, 137, 139, 149, 151 ,157 ,163,...

Cambridge IELTS 15 Reading Test 1 Answers

Cambridge IELTS 15 Reading Test 1 Answers

PASSAGE 1: NUTMEG – A VALUABLE SPICE QUESTIONS 1- 4: COMPLETE THE NOTES BELOW.CHOOSE ONE WORD ONLY FROM THE PASSAGE FOR EACH ANSWER.WRITE YOUR ANSWER IN BOXES 1-8 ON YOUR ANSWER SHEET. 1. Answer: oval Key words: leaves, shape Using the scanning skill,...

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 2 ANSWERS

Cambridge IELTS 14 is the latest IELTS exam preparation.https://draftsbook.com/ will help you to answer all questions in cambridge ielts 14 reading test 2 with detail explanations. PASSAGE 1: ALEXANDER HENDERSON (1831-1913) QUESTIONS 1-8: DO THE FOLLOWING...

Cambridge IELTS 14 Reading Test 1 Answers

Cambridge IELTS 14 Reading Test 1 Answers

Cambridge IELTS 14 is the latest IELTS exam preparation.https://draftsbook.com/ will help you to answer all questions in cambridge ielts 14 reading test 1 with detail explanations. PASSAGE 1: THE IMPORTANCE OF CHILDREN’S PLAY QUESTIONS 1-8: COMPLETE THE NOTES BELOW....