답안 #211766

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
211766 2020-03-21T08:07:18 Z goodboy Potatoes and fertilizers (LMIO19_bulves) C++14
0 / 100
158 ms 7064 KB
#include <stdio.h> 
#include <math.h>
using namespace std;
 
int main() {
    int n , a , b , prefix = 0;
    scanf("%d",&n);
	long long ans = 0;
    for (int i = 1; i <= n; i++) {
    	scanf("%d%d",&a,&b);
      	prefix += (a-b);
      	ans += abs(prefix);
  	}
  	printf("%lld\n",ans);
  	return 0;
}

Compilation message

bulves.cpp: In function 'int main()':
bulves.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
bulves.cpp:10:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
      scanf("%d%d",&a,&b);
      ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 16 ms 640 KB Output is correct
5 Correct 27 ms 1024 KB Output is correct
6 Correct 76 ms 3704 KB Output is correct
7 Correct 158 ms 7064 KB Output is correct
8 Incorrect 111 ms 5240 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 16 ms 640 KB Output is correct
5 Correct 27 ms 1024 KB Output is correct
6 Correct 76 ms 3704 KB Output is correct
7 Correct 158 ms 7064 KB Output is correct
8 Incorrect 111 ms 5240 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Incorrect 4 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Incorrect 4 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Incorrect 4 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -