fork download
  1. #include <iostream>
  2. using namespace std;
  3. /*
  4. //Zadanie 5
  5. int main() {
  6. int n, a, b;
  7. cin>>n;
  8. if (n<10) cout <<"tak";
  9. else{
  10. b=n%10;
  11. n=(n-b)/10;
  12. while (n>0){
  13. a=n%10;
  14. if (a>b){
  15. cout<<"nie";
  16. break;
  17. }
  18. n=(n-a)/10;
  19. b=a;
  20. }
  21. if (n==0) cout <<"taak";
  22. }
  23. return 0;
  24. }
  25.  
  26. //zadanie 6
  27. int main(){
  28. int n, c;
  29. cin >>n;
  30. if (n==0) cout<<"0";
  31. else {
  32. while (n>0){
  33. c=n%10;
  34. n=(n-c)/10;
  35. cout<<c;
  36. }
  37. }
  38. return 0;
  39. }
  40.  
  41. //Zadanie 7
  42. int main(){
  43. int n, c;
  44. string s="";
  45. cin>>n;
  46. if (n==0) cout <<"0";
  47. else{
  48. while (n>0){
  49. c=n%2;
  50. n=(n-c)/2;
  51. if (c=0) s="0"+s;
  52. else s="1"+s;
  53. }
  54. cout<<s;
  55. }
  56. return 0;
  57. }
  58.  
  59. //Zadanie 8
  60. int main(){
  61. char cyfry[]="01234567";
  62. int n, c;
  63. string s="";
  64. cin>>n;
  65. if (n==0) cout <<"0";
  66. else{
  67. while (n>0){
  68. c=n%8;
  69. n=(n-c)/8;
  70. s=cyfry[c]+s;
  71. }
  72. cout<<s;
  73. }
  74. return 0;
  75. }
  76.  
  77. //Zadanie 9
  78. int main(){
  79. char cyfry[]="0123456789ABCDEFGHIJKLMNOPRSTUVWXYZ";
  80. int d, n, c;
  81. string s="";
  82. cin>>d>>n;
  83. if (n==0) cout<<"0";
  84. else{
  85. while (n>0){
  86. c=n%d;
  87. n=(n-c)/d;
  88. s=cyfry[c]+s;
  89. }
  90. cout<<s;
  91. }
  92. return 0;
  93. }
  94.  
  95. //Zadanie 10
  96. int main(){
  97. int a, b, nwd;
  98. cin>>a>>b;
  99. int aa=a, bb=b;
  100. while (a!=b){
  101. if (a>b) a-=b;
  102. else b-=a;
  103. }
  104. cout<<"nwd("<<aa<<","<<bb<<")="<<a;
  105. return 0;
  106. }
  107.  
  108. //Zadanie 11
  109. int main(){
  110. int a, b, nwd;
  111. cin>>a>>b;
  112. int aa=a, bb=b;
  113. while (a!=b){
  114. if (a>b) a-=b;
  115. else b-=a;
  116. }
  117. cout<<"nwd("<<aa<<","<<bb<<")="<<aa*bb/a;
  118. return 0;
  119. }
  120.  
  121. //Zadanie 12
  122. int main(){
  123. int a;
  124. cin>>a;
  125. int nwd=a;
  126. while(a!=0){
  127. while (nwd!=a){
  128. if (a>nwd) a-=nwd;
  129. else nwd -=a;
  130. }
  131. cin>>a;
  132. }
  133. cout<<nwd;
  134. return 0;
  135. }
  136.  
  137. //Zadanie 13
  138. int main(){
  139. int g, s;
  140. cin>>g>>s;
  141. while (g!=s){
  142. if (g>s) g-=s;
  143. else s-=g;
  144. }
  145. cout<<g;
  146. return 0;
  147. }
  148.  
  149. //Zadanie 14
  150. int main() {
  151. int g, s;
  152. cin >> g >> s;
  153. int gg=g, ss=s;
  154. while (g!=s){
  155. if (g>s) g -= s;
  156. else s -= g;
  157. }
  158. cout << (gg+ss)/g;
  159. return 0;
  160. }
  161.  
  162. //Zadanie 15
  163. int main() {
  164. int x, y;
  165. cin >> x >> y;
  166. int xx=x, yy=y;
  167. while (x!=y){
  168. if (x>y) x -= y;
  169. else y -= x;
  170. }
  171. cout << xx*yy/x;
  172. return 0;
  173. }
  174.  
  175. //Zadanie 16
  176. int main() {
  177. int x, y;
  178. cin >> x >> y;
  179. int xx=x, yy=y;
  180. while (x!=y){
  181. if (x>y) x -= y;
  182. else y -= x;
  183. }
  184. cout << (xx/x)*(yy/x);
  185. return 0;
  186. }
  187.  
  188. //Zadanie 17
  189. int main() {
  190. int n, c;
  191. int tab[10] = {0};
  192. bool czy = false;
  193. cin >> n;
  194. while (n>0){
  195. c= n%10;
  196. tab[c] ++;
  197. n = (n-c)/10;
  198. if (tab[c]>1){
  199. czy = true;
  200. }
  201. }
  202. if (czy) cout << "tak";
  203. else cout << "nie";
  204. return 0;
  205. }
  206.  
  207. //Zadanie 18
  208. int main() {
  209. int a=0, b=0, n;
  210. cin >> n;
  211. while (n>0){
  212. b=a;
  213. a=n;
  214. cin >> n;
  215. }
  216. cout << a+b;
  217. return 0;
  218. }
  219. */
  220. //Zadanie 19
  221. int main() {
  222. int suma=0, c, n;
  223. cin >> n;
  224. while (n>0){
  225. c = n%10;
  226. if (c%2==0) suma += c;
  227. n = (n-c)/10;
  228. }
  229. cout << suma;
  230. return 0;
  231. }
  232.  
Success #stdin #stdout 0s 5316KB
stdin
27
36
stdout
2