Advertisement
dllbridge

Untitled

Dec 28th, 2023
1,238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.53 KB | None | 0 0
  1.  
  2.  
  3. /*  
  4. //            https://disk.yandex.ru/d/7vJs2xn1DoJcCg
  5. //            Оптимизировать решение
  6. #include  <iostream>
  7. using namespace std;
  8.  
  9.  
  10. ///////////////////////////////////////////////
  11. int main()                                   //  
  12. {
  13.    
  14.     int d1;
  15.    
  16.     cin >> d1;
  17.    
  18.     int d2 = d1 / 7;
  19.    
  20.     if(d1 % 7 == 0)     cout << d2 * 5845;   
  21.     if(d1 % 7 == 1)     cout << d2 * 5845 + 1000;
  22.  
  23.     if (d1 % 7 == 2)
  24.       {
  25.       cout << d2 * 5845 + 1945;
  26.       }
  27.     if (d1 % 7 == 3)
  28.       {
  29.       cout << d2 * 5845 + 2835;
  30.       }
  31.     if (d1 % 7 == 4)
  32.       {
  33.       cout << d2 * 5845 + 3670;
  34.       }
  35.     if (d1 % 7 == 5)
  36.       {
  37.       cout << d2 * 5845 + 4450;
  38.       }
  39.     if (d1 % 7 == 6)
  40.       {
  41.       cout << d2 * 5845 + 5175;
  42.       }
  43. }
  44.  
  45.  
  46. */
  47.  
  48.  
  49.  
  50. #include    <stdio.h>
  51. #include   <stdlib.h>
  52. #include     <time.h>
  53.  
  54. int nArr[100];
  55.  
  56.  
  57. ////////////////////////////////////////////////////////
  58. int main()                                            //
  59. {
  60.    
  61.     srand(time(0));
  62.    
  63.     for(int i = 0; i < 10; i++)
  64.     {
  65.        
  66.        nArr[i] = rand();
  67.    
  68.        printf("nArr[%d]  = %d \n", i, nArr[i]);
  69.     }
  70. }
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83. /*
  84.  
  85.  
  86. #include   <stdio.h>
  87.  
  88.  
  89. int n = 7;
  90.  
  91. //    Разбить на if & goto
  92. ////////////////////////////////////////////////////////
  93. int main()                                            //
  94. {
  95.    
  96.     switch(n)
  97.     {
  98.        
  99.        case 5:   printf("May   \n");       
  100.                  break;
  101.                            
  102.        case 7:   printf("July  \n");                         
  103.                  break;
  104.                  
  105.        case 8:   printf("August\n");       
  106.                  break;
  107.                                
  108.        default:  printf("Error!\n");          
  109.        
  110.     }
  111. }
  112.  
  113.  
  114. */
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128. /*
  129.  
  130.  
  131. #include   <stdio.h>
  132.  
  133.  
  134.  
  135. char c = 48;
  136.  
  137. char szArr[50] = "SONY";
  138.  
  139. ////////////////////////////////////////////////////////
  140. int main()                                            //
  141. {
  142.    
  143.  
  144.                
  145.     printf("    c = %c\n", c    );  
  146.     printf("szArr = %s\n", szArr);
  147.     printf("- - - - - - - - - \n");
  148.    
  149.     int i = 0;
  150.    
  151.    
  152.    
  153.  
  154.        
  155. L_01:   printf("szArr[%d] = %c\n", i, szArr[i]);
  156.        
  157.         i++;
  158.  
  159.         if(i < 5) goto L_01;
  160.  
  161. return 0;
  162. }
  163.  
  164.  
  165.  
  166. #include   <stdio.h>
  167.  
  168.  
  169.  
  170. char c = 48;
  171.  
  172. char szArr[50] = "SONY";
  173.  
  174. ////////////////////////////////////////////////////////
  175. int main()                                            //
  176. {
  177.    
  178.  
  179.                
  180.     printf("    c = %c\n", c    );  
  181.     printf("szArr = %s\n", szArr);
  182.     printf("- - - - - - - - - \n");
  183.     for(int i = 0; i < 5; i = i + 1)
  184.     {
  185.        
  186.         printf("szArr[%d] = %c\n", i, szArr[i]);
  187.     }
  188.  
  189.  
  190. return 0;
  191. }
  192. */
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement