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 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): 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...
Problem details link: http://acm.timus.ru/problem.aspx?space=1&num=1009 Problem Description: This is a straightforward problem check validity of K-based numbers. Problem Solution: #include <stdio.h> int main() { int m[1009],n,k; scanf("%d...
Timus problem 1025 Democracy in Danger : This problem is for beginner. Problem Details: http://acm.timus.ru/problem.aspx?space=1&num=1025 Problem Description: This is a Straightforward problem. Timus Problem 1025 Solution #include<stdio.h> int main() { int...
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 #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 #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 #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;...
#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];...
#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 #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 #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 #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 #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;...
#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 1224 Solution #include <stdio.h> int main() { long int n, m,o; scanf("%ld%ld", &n, &m); o=n <= m ? 2 * n - 2 : 2 * m - 1; printf("%u",o); }
Timus Problem 1225 Solution #include <stdio.h> int main() { int n, m; scanf("%d", &n); m=2*n-2; printf("%d",m); }
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;...
#include <stdio.h> int main() { long long int a,b,l=0,r=0; scanf("%lld",&a); r=a%7; printf("minr=%lld",r); return 0; }
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; }...
Dive into the world of AI tools with our comprehensive guide. Explore categories, benefits, and top applications transforming industries and daily life in 2024.
Get ready for PHP 8.5, scheduled for release on November 20, 2025! Explore the upcoming features, performance boosts, and essential migration strategies for a smoother transition.
Get an early look at Python 3.14, slated for 2025! Explore expected features, performance boosts, and how it will shape Python development and data science.
The world of AI evolves at lightning speed. Discover why staying informed on the latest AI news, breakthroughs, and industry trends is essential for everyone.