Posts

solution of TIPTOP - Tip Top Game on spoj

solution- #include<stdio.h> #include<math.h> int main() {long long int t,i,n,k; scanf("%lld",&t); for(i=1;i<=t;i++) { scanf("%lld",&n); k=sqrt(n); if(k*k==n) { printf("Case %lld: Yes",i); printf("\n"); } else {printf("Case %lld: No",i); printf("\n"); } } } Problem Statement: Alim and sufian are two good friends. They loves to playing game with number recently they discover a new game name “Tip Top”. The rule of the game is they took a number ( N ) randomly after that they find the all divisors of N. Then they starting to play the game first alim took a divisor, then sufian so on. The person who took the last divisor will win the game. Every time the game started with alim . Now alim wants to know when he will win. As you a good programmer your task is to find will alim win or not.   Input: Input starts with an integer  T ( T ≤ 10 5  ) , denoti...
Image
SOLUTION- #include<stdio.h> int main() { int i,k,a; scanf("%d",&k); for(i=1;i<=k;i++) { scanf("%d",&a); switch (a) { case 0: printf("Case %d: abcdef\n",i); break; case 1: printf("Case %d: bc\n",i); break; case 2: printf("Case %d: abdeg\n",i); break; case 3: printf("Case %d: abcdg\n",i); break; case 4: printf("Case %d: bcfg\n",i); break; case 5: printf("Case %d: acdfg\n",i); break; case 6: printf("Case %d: acdefg\n",i); break; case 7: printf("Case %d: abc\n",i); break; case 8: printf("Case %d: abcdefg\n",i); break; case 9: printf("Case %d: abcdfg\n",i); break; }} return 0; } Nobel the Littlefinger is a follower of Lord of Light. So he likes  7-segment display  so much because that works with LED lights. This is a model of  7-s...