제출 #391329

#제출 시각아이디문제언어결과실행 시간메모리
391329shahriarkhanBigger segments (IZhO19_segments)C++14
0 / 100
1 ms204 KiB
#include<bits/stdc++.h> using namespace std ; int main() { int n ; scanf("%d",&n) ; long long a[n+1] , prev = 0 , cur = 0 , ans = 1 ; for(int i = 1 ; i <= n ; ++i) scanf("%lld",&a[i]) ; for(int i = 1 ; i < n ; ++i) { if((cur+a[i])>=prev) { cur += a[i] , prev = cur , cur = 0 ; ++ans ; } else cur += a[i] ; } printf("%d\n",ans) ; return 0 ; }

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

segments.cpp: In function 'int main()':
segments.cpp:19:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   19 |     printf("%d\n",ans) ;
      |             ~^    ~~~
      |              |    |
      |              int  long long int
      |             %lld
segments.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    7 |     scanf("%d",&n) ;
      |     ~~~~~^~~~~~~~~
segments.cpp:9:40: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    9 |     for(int i = 1 ; i <= n ; ++i) scanf("%lld",&a[i]) ;
      |                                   ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...