Advertisement
Arrias

Untitled

May 19th, 2018
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. //1. Сумма цифр четырехзначного числа
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. int main()
  8. {
  9. int k;
  10. cin >> k;
  11. cout << k%10 + k/10%10 + k/100%10 + k/1000%10 << endl;
  12.  
  13. }
  14. //2. k-я секунда суток
  15. #include <bits/stdc++.h>
  16.  
  17. using namespace std;
  18.  
  19.  
  20. int main()
  21. {
  22. int k;
  23. cin >> k;
  24. cout << "It is " << k/3600 << " hours " << (k%3600)/60 << " minutes.";
  25.  
  26. }
  27. //3. Часовая стрелка
  28. #include <bits/stdc++.h>
  29.  
  30. using namespace std;
  31.  
  32.  
  33. int main()
  34. {
  35. int d;
  36. cin >> d;
  37. int k = d * 120;
  38. cout <<"It is "<< k/3600 <<" hours " << (k%3600)/60 << " minutes.";
  39. return 0;
  40.  
  41. }
  42. //4. Симметричное число
  43. #include <bits/stdc++.h>
  44.  
  45. using namespace std;
  46.  
  47.  
  48. int main()
  49. {
  50. int d;
  51. cin >> d;
  52. int k1 = d % 10;
  53. int k2= d/10%10;
  54. int k3= d/100%10;
  55. int k4 = d/1000%10;
  56. cout << (k1 == k4 && k2 == k3);
  57. }
  58.  
  59. //5. Урок в неделе
  60. #include <bits/stdc++.h>
  61.  
  62. using namespace std;
  63.  
  64.  
  65. int main()
  66. {
  67. int d;
  68. int f;
  69. cin >> d >> f;
  70. cout << 6* (d-1) + f;
  71. }
  72. //6. Без циклов
  73. #include <bits/stdc++.h>
  74.  
  75. using namespace std;
  76.  
  77.  
  78. int main()
  79. {
  80. int k,n;
  81. cin >> k >> n;
  82. int d = (n + k - 1) /k;
  83. cout << d << ' ' << (n-1)%k + 1;
  84. }
  85.  
  86. //7. День недели
  87. #include <bits/stdc++.h>
  88.  
  89. using namespace std;
  90.  
  91.  
  92. int main()
  93. {
  94. int m,n;
  95. cin >> n >> m;
  96. int d = m + n - 1;
  97. cout << (d - 1) % 7 + 1;
  98. }
  99. //8. Покупка
  100. #include <bits/stdc++.h>
  101.  
  102. using namespace std;
  103.  
  104.  
  105. int main()
  106. {
  107. int a,b,n;
  108. cin >> a >> b >> n;
  109. cout << a*n + (b*n)/100 << ' ' << (b*n)%100;
  110. }
  111. //9.
  112. #include <bits/stdc++.h>
  113.  
  114. using namespace std;
  115.  
  116.  
  117. int main()
  118. {
  119. double a;
  120. cin >> a;
  121. cout << (int)a << ' ' << (a - (int)a) * 100 ;
  122. }
  123. //10. Два момента времени
  124. #include <bits/stdc++.h>
  125.  
  126. using namespace std;
  127.  
  128. int h, m, s;
  129. int h1, m1, s1;
  130.  
  131. int main(){
  132. cin >> h >> m >> s >> h1 >> m1 >> s1;
  133. cout << ((h1 - h - 1) * 3600) + ((60 - m - 1) * 60) + (60 - s) + (m1 * 60) + s1;
  134. return 0;
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement