Submission #1110660

# Submission time Handle Problem Language Result Execution time Memory
1110660 2024-11-10T07:14:51 Z vjudge1 Tuna (COCI17_tuna) C++
Compilation error
0 ms 0 KB
#include <stdio.h>

int main() {
    int y, x, a, z, b, toplam = 0;
    scanf("%d", &y);
    scanf("%d", &x);
    for (int i = 0; i < y; i++) {
        scanf("%d, %d", &a, &z);
        int fark = a - z;
        if (fark < 0) fark = -fark; 
        if (fark <= x) {  
            toplam += (a > z) ? a : z;  
        } 
            scanf("%d", &b);  
            toplam += b;  
        }
    

Compilation message

tuna.cpp: In function 'int main()':
tuna.cpp:16:9: error: expected '}' at end of input
   16 |         }
      |         ^
tuna.cpp:3:12: note: to match this '{'
    3 | int main() {
      |            ^
tuna.cpp:5:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |     scanf("%d", &y);
      |     ~~~~~^~~~~~~~~~
tuna.cpp:6:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |     scanf("%d", &x);
      |     ~~~~~^~~~~~~~~~
tuna.cpp:8:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |         scanf("%d, %d", &a, &z);
      |         ~~~~~^~~~~~~~~~~~~~~~~~
tuna.cpp:14:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |             scanf("%d", &b);
      |             ~~~~~^~~~~~~~~~