답안 #1110656

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1110656 2024-11-10T07:08:10 Z vjudge1 Tuna (COCI17_tuna) C++
컴파일 오류
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);
      |             ~~~~~^~~~~~~~~~