제출 #136914

#제출 시각아이디문제언어결과실행 시간메모리
136914dnassTuna (COCI17_tuna)C++14
50 / 50
7 ms376 KiB
#include <bits/stdc++.h>
using namespace std;

int myabs(int k){
	if(k<0) return -k;
	return k;
}

int n, x;

int main(){
	scanf("%d %d", &n, &x);
	int sum = 0;
	while(n--){
		int p1, p2; scanf("%d %d", &p1, &p2);
		if(myabs(p1-p2)<=x) sum += max(p1, p2);
		else{
			int p3; scanf("%d", &p3);
			sum += p3;
		}
	}
	printf("%d\n", sum);
	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

tuna.cpp: In function 'int main()':
tuna.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &x);
  ~~~~~^~~~~~~~~~~~~~~~~
tuna.cpp:15:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int p1, p2; scanf("%d %d", &p1, &p2);
               ~~~~~^~~~~~~~~~~~~~~~~~~
tuna.cpp:18:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    int p3; scanf("%d", &p3);
            ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...