Submission #1110646

# Submission time Handle Problem Language Result Execution time Memory
1110646 2024-11-10T06:52:02 Z vjudge1 Tuna (COCI17_tuna) C++17
50 / 50
1 ms 336 KB
#include <iostream>
using namespace std;

int main()
{
    int teklif = 0;
    int fark = 0;
    int toplam = 0;
    scanf("%d %d",&teklif,&fark);
    for(int i = 0;i < teklif; ++i){
        int a = 0,b = 0;
        scanf("%d %d",&a,&b);
        if(abs(a - b) <= fark){
            toplam += max(a,b);
        }
        else{
            int c = 0;
            scanf("%d",&c);
            toplam += c;
        }
        
    }
    printf("%d",toplam);
    return 0;
}

Compilation message

tuna.cpp: In function 'int main()':
tuna.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d %d",&teklif,&fark);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
tuna.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         scanf("%d %d",&a,&b);
      |         ~~~~~^~~~~~~~~~~~~~~
tuna.cpp:18:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |             scanf("%d",&c);
      |             ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct