fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4. /*
  5. //Zadanie 1
  6. int main(){
  7. int a, b, c;
  8. cin>>a>>b>>c;
  9. if (a<b) {if (a<c) cout<<a;
  10. else cout <<c;
  11. }
  12. else {
  13. if (c<b) cout<<c;
  14. else cout<<b;
  15. }
  16. return 0;
  17. }
  18.  
  19. //Zadanie 2
  20. int main(){
  21. int a, b, c;
  22. cin>>a>>b>>c;
  23. if (a=b){cout<<"tak";}
  24. else {if (a==c) cout<<"tak";
  25. else if (b==c) cout<<"tak";
  26. else cout<<"nie";
  27. }
  28. return 0;
  29. }
  30.  
  31. //Zadanie 3
  32. int main(){
  33. int x;
  34. cin>>x;
  35. if((x>=1 and x<=10) or (x>=17 and x<=21))
  36. cout<<"tak";
  37. else cout <<"nie";
  38. return 0;
  39. }
  40.  
  41. //Zadanie 4
  42. int main(){
  43. float x, y;
  44. cin>>x>>y;
  45. if (x*y==0) cout <<"punkt leż na osi.";
  46. else if (x>0)
  47. if(y>0) cout<<"punkt leży w 1 ćwiartce";
  48. else cout <<"punkt leży w 4";
  49. else if (y>0) cout<<"punkt leż w 2 ćwiartce";
  50. else cout <<"punkt leży w 3 ćwiartce";
  51. return 0;
  52. }
  53.  
  54. //Zadanie 5
  55. int main(){
  56. int a, b, c;
  57. cin>>a>>b>>c;
  58. a=a*a;
  59. b=b*b;
  60. c=c*c;
  61. if (a==b+c or b==a+c or c==a+b) cout<<"liczby pitagorejskie";
  62. else
  63. cout<<"to nie sa pitagorejskie";
  64. return 0;
  65. }
  66.  
  67. //Zadanie 6
  68. int main(){
  69. int x1, x2, x3, y1, y2, y3;
  70. cin>>x1>>x2>>x3>>y1>>y2>>y3;
  71. if (2*x3==x1+x2 && 2*y3==y1+y2)
  72. cout << "tak";
  73. else
  74. cout <<"nie";
  75. return 0;
  76. }
  77.  
  78. //Zadanie 7
  79. int main(){
  80. int a;
  81. cin >>a;
  82. if ((a%4==0 && a%100!=0) or a%400==0) cout<<"tak";
  83. else cout<<"nie";
  84. return 0;
  85.  
  86. }
  87.  
  88. //Zadanie 8
  89. int main(){
  90. int d, m, r;
  91. cin>>d>>m>>r;
  92. if (d<0 and d<32 and m>0 and m<13 and r>1899 and r<2051)
  93. cout <<setfill('0')<<setw(2)<<d<<"."<<setw(2)<<m<<"."<<r;
  94. else
  95. cout<<"nie ma takiej daty";
  96. return 0;
  97. }
  98.  
  99. //Zadanie 9
  100. int main(){
  101. int a, b, r;
  102. cin>>a>>b;
  103. r=(a+b)%10;
  104. if (r%3==0) cout<<"tak";
  105. else cout<<"nie";
  106. return 0;
  107. }
  108.  
  109. //Zadanie 10
  110. int main() {
  111. int r, m, d, rr, mm, dd;
  112. cin >> r >> m >> d >> rr >> mm >> dd;
  113. if (r==rr and m==mm and d==dd) cout << "Daty sa rowne";
  114. else if ((r<rr) or (r==rr and m<mm) or (r==rr and m==mm and d<dd))
  115. cout << r << " " << m << " " << d;
  116. else cout << rr << " " << mm << " " << dd;
  117. return 0;
  118. }
  119.  
  120. //Zadanie 11
  121. #include <cmath>
  122. int main(){
  123. float a,b,c,d,x1,x2;
  124. cin >> a >> b >> c;
  125. if (a==0)
  126. if (b==0)
  127. if (c==0) cout << "nieskonczenie wiele rozwiazan";
  128. else cout << "brak rozwiazan";
  129. else cout << -c/b;
  130. else {
  131. d = b*b-4*a*c;
  132. if (d<0) cout << "brak rozwiazan";
  133. else if (d==0) cout << -b/(2*a);
  134. else {
  135. x1 = (-b-sqrt(d))/(2*a);
  136. x2 = (-b+sqrt(d))/(2*a);
  137. if (x1<x2) cout << x1 << endl << x2;
  138. else cout << x2 << endl << x1;
  139. }
  140. }
  141. return 0;
  142. }
  143.  
  144. //Zadanie 12
  145. #include <cmath>
  146. using namespace std;
  147.  
  148. int main() {
  149. int d, m, r, du, mu, ru, lm;
  150. cin >> r >> m >> d;
  151. cin >> ru >> mu >> du;
  152. if ((r-ru>18) or (r-ru==18 and m>mu) or (r-ru==18 and m==mu and d>du))cout << "TAK";
  153. else if (r-ru==18 and m==mu and d==du) cout << "Wszystkiego najlepszego!";
  154. else{
  155. lm = (ru+18-r)*12 + (mu-m);
  156. cout << "NIE, pelnoletnosc osiagniesz za " << lm << " miesiecy.";
  157. }
  158. return 0;
  159. }
  160.  
  161. //Zadanie 13
  162. int main() {
  163. float a, b;
  164. char znak;
  165. cin >> a >> b >> znak;
  166. switch (znak){
  167. case '+':
  168. cout << a+b;
  169. break;
  170. case '-':
  171. cout << a-b;
  172. break;
  173. case '*':
  174. cout << a*b;
  175. break;
  176. case '/':
  177. cout << a/b;
  178. break;
  179. default:
  180. cout << "Nie umiem wykonac tej operacji.";
  181. }
  182. return 0;
  183. }
  184.  
  185. //Zadanie 14
  186. int main() {
  187. float pty;
  188. cin >> pty;
  189. int ile = pty/6;
  190. switch (ile){
  191. case 10:
  192. cout << "bardzo dobry";
  193. break;
  194. case 9:
  195. cout << "bardzo dobry";
  196. break;
  197. case 8:
  198. cout << "dobry+";
  199. break;
  200. case 7:
  201. cout << "dobry";
  202. break;
  203. case 6:
  204. cout << "dostateczny+";
  205. break;
  206. case 5:
  207. cout << "dostateczny";
  208. break;
  209. default:
  210. cout << "niedostateczny";
  211. }
  212. return 0;
  213. }
  214.  
  215. //Zadanie 15
  216. int main(){
  217. int a, b;
  218. cin>>a>>b;
  219. bool czy=a>b;
  220. switch(czy){
  221. case true:
  222. cout<<a;
  223. break;
  224. case false:
  225. cout<<b;
  226. break;
  227. }
  228. return 0;
  229. }
  230.  
  231. //Zadanie 16
  232. int main(){
  233. int n;
  234. cin>>n;
  235. bool czy=n%5==0 and n%11!=0;
  236. switch(czy){
  237. case 1:
  238. cout<<"tak";
  239. break;
  240. default:
  241. cout<<"nie";
  242. }
  243. return 0;
  244. }
  245.  
  246. //Zadanie 18
  247. int main() {
  248. int n;
  249. cin >> n;
  250. switch (n){
  251. case 1:
  252. cout << "poniedzialek";
  253. break;
  254. case 2:
  255. cout << "wtorek";
  256. break;
  257. case 3:
  258. cout << "sroda";
  259. break;
  260. case 4:
  261. cout << "czwartek";
  262. break;
  263. case 5:
  264. cout << "piatek";
  265. break;
  266. case 6:
  267. cout << "sobota";
  268. break;
  269. case 7:
  270. cout << "niedziela";
  271. break;
  272. default:
  273. cout << "Nie ma takiego dnia w tygodniu.";
  274. }
  275. return 0;
  276. }
  277.  
  278. //Zadanie 19
  279. #include <cmath>
  280.  
  281. int main() {
  282. float a, b;
  283. char znak;
  284. cin >> a >> b >> znak;
  285. switch (znak){
  286. case 'a':
  287. cout << (a+b)/2;
  288. break;
  289. case 'g':
  290. cout << sqrt(a*b);
  291. break;
  292. case 'h':
  293. cout << 2/(1/a+1/b);
  294. break;
  295. default:
  296. cout << "Nie umiem obliczyc takiej sredniej.";
  297. }
  298. return 0;
  299. }
  300.  
  301. //Zadanie 20
  302. #include <cmath>
  303.  
  304. int main() {
  305. int rok, m, luty=28;
  306. cin >> rok >> m;
  307. if ((rok%4==0 and rok%100!=0) or (rok%400==0)) luty++;
  308. switch (m){
  309. case 2:
  310. cout << luty;
  311. break;
  312. case 4:
  313. cout << 30;
  314. break;
  315. case 6:
  316. cout << 30;
  317. break;
  318. case 9:
  319. cout << 30;
  320. break;
  321. case 11:
  322. cout << 30;
  323. break;
  324. default:
  325. cout << 31;
  326. break;
  327. }
  328. return 0;
  329. }
  330.  
  331. //Zadanie 21
  332. #include <iomanip>
  333.  
  334.  
  335. int main() {
  336. int k;
  337. float cena;
  338. cin >> k;
  339. if (k<0) cena = -1;
  340. else if (k<=10) cena = 2;
  341. else if (k>=11 and k<=30) cena = 1 + k*0.1;
  342. else cena = 1 + k*0.08;
  343. cout << fixed << setprecision(2) << cena << " zl";
  344. return 0;
  345. }
  346. */
  347. //Zadanie 22
  348. #include <iomanip>
  349.  
  350. int main() {
  351. int n, zar;
  352. cin >> n;
  353. if (n>50) zar = 30*n;
  354. else zar = 20*n;
  355. cout << zar;
  356. return 0;
  357. }
  358.  
Success #stdin #stdout 0s 5328KB
stdin
12 10 *
stdout
240