Submission #1110646

#TimeUsernameProblemLanguageResultExecution timeMemory
1110646vjudge1Tuna (COCI17_tuna)C++17
50 / 50
1 ms336 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...