UVA Problem 455 Periodic Strings Solution

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;...

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...

Laravel – Scopes (3 Easy Steps)

Laravel – Scopes (3 Easy Steps)

Scoping is one of the superpowers that eloquent grants to developers when querying a model. Scopes allow developers to add constraints to queries for a given model. In simple terms laravel scope is just a query, a query to make the code shorter and faster. We can...

CAMBRIDGE IELTS 17 TEST 3

CAMBRIDGE IELTS 17 TEST 3

READING PASSAGE 1: The thylacine Q1. carnivorous keywords: Looked like a dog had series of stripes ate, diet ate an entirely 1 .......................................... diet (2nd paragraph 3rd and 4th line) 1st and 2nd paragraph, 1st  paragraph,resemblance to a...

Cambridge IELTS 16 Test 4

Cambridge IELTS 16 Test 4

Here we will discuss pros and cons of all the questions of the passage with step by step Solution included Tips and Strategies. Reading Passage 1 –Roman Tunnels IELTS Cambridge 16, Test 4, Academic Reading Module, Reading Passage 1 Questions 1-6. Label the diagrams...

Cambridge IELTS 16 Test 3

Cambridge IELTS 16 Test 3

Reading Passage 1: Roman Shipbuilding and Navigation, Solution with Answer Key , Reading Passage 1: Roman Shipbuilding and Navigation IELTS Cambridge 16, Test 3, Academic Reading Module Cambridge IELTS 16, Test 3: Reading Passage 1 – Roman Shipbuilding and...