Advertisement
Guest User

Chef and Typing

a guest
Oct 20th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.71 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. #include <string.h>
  4.  
  5. int main()
  6.  
  7. {
  8.  
  9.     int testcase , n , a , b , r ;
  10.  
  11.     double add , total , another ;
  12.  
  13.     scanf("%d",&testcase) ;
  14.  
  15.     while( testcase-- )  {
  16.  
  17.         another = 0.0 ;
  18.  
  19.         total = 0.0 ;
  20.  
  21.         scanf("%d",&n) ;  getchar() ;  // space soranor jonno getchar() ;
  22.  
  23.         char lotus[n][20] ;
  24.  
  25.         double eater[n] ;
  26. /*
  27.  
  28. df fd jk kj dd ff jj kk er jonno 0.4 baki sob .2 and 1st one er jonno .2
  29.  
  30.  
  31.  
  32.  
  33. */
  34.         for( a = 0 ; a < n ; a++ )  {
  35.  
  36.             add = 0 ;
  37.  
  38.             scanf("%s",lotus[a]) ;
  39.  
  40.             for( b = 0 ; lotus[a][b] != '\0' ; b++ )  {
  41.  
  42.                 if( b == 0 )  add += 0.2 ;
  43.  
  44.                 else  {
  45.  
  46.                     if( lotus[a][b-1] == 'd' && lotus[a][b] == 'f' )  add += 0.4 ;
  47.  
  48.                     else if( lotus[a][b-1] == 'f' && lotus[a][b] == 'd' )  add += 0.4 ;
  49.  
  50.                     else if( lotus[a][b-1] == 'j' && lotus[a][b] == 'k' )  add += 0.4 ;
  51.  
  52.                     else if( lotus[a][b-1] == 'k' && lotus[a][b] == 'j' )  add += 0.4 ;
  53.  
  54.                     else if( lotus[a][b-1] == 'd' && lotus[a][b] == 'd' )  add += 0.4 ;
  55.  
  56.                     else if( lotus[a][b-1] == 'f' && lotus[a][b] == 'f' )  add += 0.4 ;
  57.  
  58.                     else if( lotus[a][b-1] == 'j' && lotus[a][b] == 'j' )  add += 0.4 ;
  59.  
  60.                     else if( lotus[a][b-1] == 'k' && lotus[a][b] == 'k' )  add += 0.4 ;  
  61.  
  62.                     else  add += 0.2 ;  
  63.  
  64.                 }
  65.  
  66.             }
  67.  
  68.             eater[a] = add ;
  69.  
  70.         }
  71.  
  72. /*
  73.  
  74. double array er number same hole then same number er jaegae -33 bosano & tar age oi number half kore another(variable) ey add kora
  75.  
  76. */
  77.  
  78.  
  79.         for( a = 0 ; a < n-1 ; a++ )  {
  80.  
  81.             if( eater[a] == -33 )  continue ;
  82.  
  83.             for( b = a+1 ; b < n ; b++ )  {
  84.  
  85.                 if( eater[a] == eater[b] )  {
  86.  
  87.                     another = another + 0.5*eater[b] ;
  88.  
  89.                     eater[b] = -33 ;
  90.  
  91.                 }
  92.  
  93.             }
  94.  
  95.         }
  96.  
  97.         for( a = 0 ; a < n ; a++ )  {
  98.  
  99.             if( eater[a] != -33 )  total += eater[a] ;
  100.  
  101.         }
  102.  
  103.         printf("%.0lf\n",( another + total)*10.0 ) ;  
  104.  
  105.     }
  106.  
  107.     return 0 ;
  108.  
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement