Timus Problem 1001 (Reverse Root) Solution

Timus Problem 1001 (Reverse Root) Solution

Timus Problem 1001(Reverse Root) : Reverse Root is a mathematical problem. To read details : http://acm.timus.ru/problem.aspx?space=1&num=1001 Proplem description: This is a straightforward problem.Just do square root. Problem Solution: #include...

Timus Problem 1005 (Stone pile) Solution

Timus Problem 1005 (Stone pile) Solution

Timus Problem 1005 (Stone pile): This problem is for beginner in timus online judge. Problem details link : http://acm.timus.ru/problem.aspx?space=1&num=1005 Problem Description: just find the minimal difference among a value range. Usage Tips: >> Right...

Timus Problem 1064(Binary Search) Solution

Timus Problem 1064(Binary Search) Solution

Problem 1064 Binary Search details description : http://acm.timus.ru/problem.aspx?space=1&num=1064 Timus Problem 1064 Solution : #include <stdio.h> int main() { int n = 1; while(n <= 100) { printf("%d\n", n); n++; if(n > 10) { break; } n = 200; while(n...

Timus Problem 1068 Solution

Timus Problem 1068 Solution

Timus Problem 1068 Solution #include <stdio.h> #include <stdlib.h> long int sum[10000]; int a[10000]; int main() { int i,n; sum[0]=1; scanf("%d",&n); for(i=0;i<=n;i++){ scanf("%d",&a[i]);} for(i=0;i<=n;i++){ sum[i]+=a[i];...

Timus Problem 1083 Solution

Timus Problem 1083 Solution

Timus Problem 1083 Solution #include <stdio.h> int main() { char ch; int n,k=0,f=1; scanf("%d %c",&n,&ch); if(ch=='!'){ printf("%c",ch); k++;} else if(ch=='\n') printf("%c",ch);{ break;} for(n=1;n<=10;n++) f*=f*(n-2k); if(f<=0){ break; }...

Timus Problem 1086 Solution

Timus Problem 1086 Solution

Timus Problem 1086 Solution #include <iostream> #include <stdio.h> using namespace std; bool flag[20000005]; int primes[20000005]; 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;...

Timus Problem 1100 Solution

Timus Problem 1100 Solution

#include <stdio.h> int main() { int i,swap,j,n,l,sum=0,k,ara[100][100]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d %d",&ara[i][j]); } for(i=0;i<n;i++) { for(j=0;j<n-i;j++) { if(ara[j]<ara[j+1]) { ara[i]=ara[i+1]; ara[i+1]=ara[j];...

Timus Problem 1104 Solution

Timus Problem 1104 Solution

#include <stdio.h> #include <ctype.h> int main() { long num=0,k,v,max=1; char ch; ch=getchar(); while(ch!=EOF) { if(isdigit(ch)) v=ch-'0'; else v=ch-'A'+10; num+=v; if(v>max) max=v; ch=getchar(); } for(k=max;k<36;k++) if(num%k==0) break; if(k<36)...

Timus Problem 1110 Solution

Timus Problem 1110 Solution

Timus Problem 1110 Solution #include<stdio.h> #include<math.h> #include<string.h> #define fi(a, b) for(int i=a; i<b; i++) #define fj(a, b) for(int j=a; j<b; j++) #define fk(a, b) for(int k=a; k<b; k++) #define sf scanf #define pf printf...

Timus Problem 1120 Solution

Timus Problem 1120 Solution

Timus Problem 1120 Solution #include <stdio.h> int main(void){ unsigned n,p,s; scanf("%u",&n); for(p=44720;n<(s=(p*(p+1))>>1)||(n-s)%p;p--); printf("%u %u\n",1+(n-s)/p,p); return 0; }  

Timus Problem 1196 Solution

Timus Problem 1196 Solution

Timus Problem 1196 Solution #include <stdio.h> int b[1000000]; int a[15000]; int main() { int i,j,k,n,m,c=0,first,last,mid; scanf("%d\n",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); } scanf("%d\n",&m); for(i=0;i<m;i++) { scanf("%d",&b[i]); }...

Timus Problem 1197 Solution

Timus Problem 1197 Solution

  Timus Problem 1197 Solution #include <stdio.h> #include <conio.h> int main() { int X, Z,t; char Y; scanf("%d",&t); while(t--){ scanf("%c%d",&Y, &Z); switch ( Y ) { case 'a': Y = 1; break; case 'b': Y = 2; break; case 'c': Y = 3; break;...

Timus Problem 1209 Solution

Timus Problem 1209 Solution

#include<stdio.h> #include<math.h> unsigned long a[70000]; int main() { unsigned long i,k,n; long double l; scanf("%lu\n",&n); for(i=0;i<n;i++) { scanf("%lu",&a[i]); } for(i=0;i<n;i++) { l=((sqrt(-7+8*a[i])-1)/ 2); k=l; if(l==k) printf("1 ");...

Timus Problem 1234 Solution

Timus Problem 1234 Solution

Timus Problem 1234 Solution #include <stdio.h> int a[10001]; int main() { int ans=0,ans1=0,k,n,i; scanf("%d %d",&n,&k); for(i=0;i<n;i++){ scanf("%d",&a[i]); } if(a[i]<k){ ans+=k-a[i]; } else{ ans1+=a[i]-k; } printf("%d %d",ans,ans1); return 0;...

Timus Problem 1263 Solution

Timus Problem 1263 Solution

Timus Problem 1263 Solution #include <stdio.h> double a[10004]; int main() { int i,m,n,l,o; double d=0; scanf("%d %d",&n,&m); l=m; while(m--) { scanf("%d",&o); a[o]++; } for(i=0;i<n;i++) { d=(a[i]/l)*100; printf("%2.2lf%%\n",d); } return 0; }...

Chapter 4 Relational Algebra

Chapter 4 Relational Algebra

Relational Algebra The part of mathematics in which letters and other general symbols are used to represent numbers and quantities in formula and equations. Ex: (x + y) · z = (x · z) + (y · z). The main application of relational algebra is providing a theoretical...

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

Database basic overview

Database basic overview

What is DBMS? A Database Management System (DBMS) is a collection of interrelated data and a set of programs to access those data. Database management systems (DBMS) are computer software applications that interact with the user, other applications, and the database...

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