Advertisement
Josif_tepe

Untitled

Nov 15th, 2022
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(){
  5. int n;
  6. scanf("%d", &n);
  7.  
  8. char milan1, milan2;
  9. char marko1, marko2;
  10. int partii_milan = 0, partii_marko = 0;
  11. for(int i = 0; i < n; i++){
  12. // scanf("%c", &milan1); // ako ne ni se citaat od tastatura ko sto treba
  13.  
  14. scanf("%c %c %c %c" , &milan1, &milan2, &marko1, &marko2);
  15.  
  16. int milan = 0;
  17. if(milan1 == 'J') {
  18. milan += 12;
  19. }
  20. else if(milan1 == 'Q') {
  21. milan += 13;
  22. }
  23. else if(milan1 == 'K') {
  24. milan += 14;
  25. }
  26. else {
  27. milan += 15;
  28. }
  29.  
  30. if(milan2 == 'J') {
  31. milan += 12;
  32. }
  33. else if(milan2 == 'Q') {
  34. milan += 13;
  35. }
  36. else if(milan2 == 'K') {
  37. milan += 14;
  38. }
  39. else {
  40. milan += 15;
  41. }
  42.  
  43. int marko = 0;
  44. if(marko1 == 'J') {
  45. marko += 12;
  46. }
  47. else if(marko1 == 'Q') {
  48. marko += 13;
  49. }
  50. else if(marko1 == 'K') {
  51. marko += 14;
  52. }
  53. else {
  54. marko += 15;
  55. }
  56. if(marko2 == 'J') {
  57. marko += 12;
  58. }
  59. else if(marko2 == 'Q') {
  60. marko += 13;
  61. }
  62. else if(marko2 == 'K') {
  63. marko += 14;
  64. }
  65. else {
  66. marko += 15;
  67. }
  68. if(milan > marko) {
  69. printf("Milan\n");
  70. partii_milan++;
  71. }
  72. else if(milan < marko) {
  73. printf("Marko\n");
  74. partii_marko++;
  75. }
  76. else {
  77. printf("Neresheno\n");
  78. }
  79. }
  80. printf("%d %d\n", partii_milan, partii_marko);
  81. return 0;
  82.  
  83. }
  84.  
  85. /*
  86. 2
  87. J J K Q
  88. A K Q K
  89.  
  90. **/
  91.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement