Advertisement
metalni

Empires & Allies

Nov 21st, 2019
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.88 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4.     int brojnaigraci, nivo, pobedi, porazi, poeni, najdobarigrac;
  5.     int poenimax=0;
  6.     scanf("%d", &brojnaigraci);
  7.  
  8.     for(int i=0; i<brojnaigraci; i++){
  9.         scanf("%d %d %d", &nivo, &pobedi, &porazi);
  10.  
  11.         //calculating the points of each player
  12.         if(nivo==1){
  13.             poeni=(pobedi*13)+(porazi*(-1));
  14.         } else if(nivo==2){
  15.             poeni=(pobedi*13)+(porazi*(-3));
  16.         }
  17.  
  18.         //pointing whether a player is good or not
  19.         if(poeni>=0){
  20.             printf("Dobar igrac\n");
  21.         } else if(poeni<0){
  22.             printf("Los igrac\n");
  23.         }
  24.  
  25.         //checking if the points are maxpoints
  26.         if(poeni>poenimax){
  27.             poenimax=poeni;
  28.             najdobarigrac=i+1;
  29.         }
  30.     }
  31.  
  32.     printf("Najdobar Igrac: br. %d, %d poeni", najdobarigrac, poenimax);
  33.  
  34.  
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement