UVA Problem 10591 Solution

UVA Problem 10591 Solution

#include<bits/stdc++.h> using namespace std; int main() { int i,j,k,d,sum,num,tc,n,ans,digit; while(cin>>tc) { for(k=1;k<=tc;k++) { cin>>n; num=n,ans=0; while(n>9) { while(n!=0) { digit=n%10; n/=10; ans+=digit*digit; } n=ans; ans=0; }...

UVA Problem 10633 Solution

UVA Problem 10633 Solution

#include<bits/stdc++.h> using namespace std; int main() { unsigned long long n,N; while(cin>>n and n>0) { N=(n*10)/9; if(n%9==0) { cout<<N-1<<" "<<N<<endl; } else { cout<<N<<endl; } } return 0; }...

UVA Problem 10656 Solution

UVA Problem 10656 Solution

#include <bits/stdc++.h> using namespace std; int a[10000]; int main() { int n,t,i,j; while(scanf("%d",&t)==1) { j=0; if(t==0) return 0; for(i=0;i<t;i++) { scanf("%d",&a[i]); if(a[i] > 0) { j++; a[n++]=a[i]; } } for(i=0;i<n;i++) { if(j==1)...

UVA Problem 10696 Solution

UVA Problem 10696 Solution

#include <stdio.h> int main() { int n; while((scanf("%d",&n)==1) && n!=0) { if(n>=101) printf("f91(%d) = %d\n",n,n-10); else printf("f91(%d) = 91\n",n); } return 0; }  

UVA Problem 10699 Solution

UVA Problem 10699 Solution

#include<bits/stdc++.h> bool flag[1000005]; int List[1000005],primes[100000]; int listSize,cnt; using namespace std; void sieve(int n) { cnt=0; primes[cnt++] = 2; for(int i=3; i<=n; i+=2) { if(flag[i] == 0) { primes[cnt++] = i; if(i <= n/i) { for(int...

UVA Problem 10734 Solution

UVA Problem 10734 Solution

#include <stdio.h> #include <string.h> int main() { char s1[500],s2[500],s1s[500],s2s[500]; int t,i,j,k; scanf("%d ",&t); for(i=0;i<t;i++){ gets(s1); gets(s2); if(strcmp(s1,s2)==0)printf("Case %d: Yes\n",i+1); else { k=0;...

UVA Problem 10773 Solution

UVA Problem 10773 Solution

#include<bits/stdc++.h> using namespace std; int main(){ double d,v,u,t1,t2; int t; cin>>t; for(int i=0;i<t;i++){ cin>>d>>v>>u; if( u==0 || v==0 || v>=u ){ printf("Case %d: can't determine\n",i+1); continue; } t1=d/u;...

UVA Problem 10783 Solution

UVA Problem 10783 Solution

#include <stdio.h> int main() { int t,a,b,i,j=1,sum; scanf("%d",&t); while( t-- ) { sum = 0; scanf("%d %d",&a,&b); for( i=a ; i<=b ; i++) { if(i%2==1) sum += i; } printf("Case %d: %d\n",j,sum); j++; } return 0; }...

UVA Problem 10784 Solution

UVA Problem 10784 Solution

#include <bits/stdc++.h> using namespace std; int main() { double N,n; int c=1; //long int n; while(cin>>N and N!=0) { n=ceil((sqrt(8*N + 9)+ 3)/2); printf("Case %d: %.lf\n",c++,n); } return 0; }...

UVA Problem 10790 Solution

UVA Problem 10790 Solution

#include<bits/stdc++.h> using namespace std; int main() { long long int a,b,i=1; while(cin>>a>>b) { if(a==0 && b==0) break; if(a==0 || b==0) { printf("Case %lld: 0\n",i); continue ; } printf("Case %lld: %lld\n",i++,((a*b*(a-1)*(b-1))/4)); }...

UVA Problem 10852 Solution

UVA Problem 10852 Solution

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

UVA Problem 10880 Solution

UVA Problem 10880 Solution

#include <iostream> #include <algorithm> #include <set> #include <cmath> using namespace std; int main(void) { int tc, c, r,t,q; set<int> v; set<int>::iterator it; cin >> tc; for (t = 0; t < tc; t++) { cin >> c...

UVA Problem 10921 ( Find the Telephone) Solution

UVA Problem 10921 ( Find the Telephone) Solution

#include <bits/stdc++.h> using namespace std; int main() { char s[200],c; int i,l,j; while(gets(s)) { l=strlen(s); for(i=0;i<l;i++) { if(s[i]=='A' ||s[i]=='B' ||s[i]=='C' ) printf("2"); else if(s[i]=='D' ||s[i]=='E' ||s[i]=='F' ) printf("3"); else...

UVA Problem 10922 (The 9s) Solution

UVA Problem 10922 (The 9s) Solution

#include <bits/stdc++.h> using namespace std; char in[1002]; int main() { int j,i,count,sum,totat,digit,deg,l,q,d; bool flag; while(1) { flag=true; sum=0; l=strlen(gets(in)); if(l==1 && in[0]=='0')return 0; for(i=0;i<l;i++) sum+=in[i]-'0';...

UVA Problem 10924 (Prime Words ) Solution

UVA Problem 10924 (Prime Words ) Solution

#include <iostream> #include <string.h> using namespace std; int main() { char s[150]; int i,j,total,result,l; while(gets(s)) { total=0; l=strlen(s); for(i=0;i<l;i++) { switch(s[i]) { case 'a': total=total+1; break; case 'b': total=total+2; break; case...

UVA Problem 10929 (You can say 11) Solution

UVA Problem 10929 (You can say 11) Solution

#include <bits/stdc++.h> using namespace std; int main() { char input[1002]; int i,j,l,sum; while(1) { gets(input); sum=0; l=strlen(input); if(input[0]=='0' and l==1) break; for(i=0;i<l;i+=2) { sum+=input[i]-'0'; } for(i=1;i<l;i+=2) { sum-=input[i]-'0'; }...

UVA Problem 10948( The primary problem) Solution

UVA Problem 10948( The primary problem) Solution

#include <stdio.h> #include<iostream> #include<math.h> #define max 1000005 using namespace std; bool flag[max]; int primes[max]; int cnt; int sieve(int z) { int i,j; for(i=2; i<=max; i++) { primes[i]=1; } for(i=2; i<=sqrt(max); i++) { for(j=2;...

UVA Problem 11000(Bee) Solution

UVA Problem 11000(Bee) Solution

#include <bits/stdc++.h> using namespace std; int main() { long int temp,male,female,total,y; int i; while(cin>>y && y>=0) { male=0,female=1; for( i=0;i<y;i++) { temp=male; male=female+temp; female=temp+1; } cout<<male<<"...

Chapter 3 Components of the Database System Environment

Chapter 3 Components of the Database System Environment

Components of the Database System Environment There are five major components in the database system environment and their interrelationships are. Hardware Software Data Users Procedures Hardware:  The hardware is the actual computer system used for keeping and...

Chapter 2: Database Languages and their information

Chapter 2: Database Languages and their information

Database Languages A DBMS must provide appropriate languages and interfaces for each category of users to express database queries and updates. Database Languages are used to create and maintain database on computer. There are large numbers of database languages like...

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