제출 #640025

#제출 시각아이디문제언어결과실행 시간메모리
640025maks007Addk (eJOI21_addk)C++14
0 / 100
162 ms824 KiB
#include "bits/stdc++.h" signed main () { int n, k; scanf("%d%d", &n, &k); int a[n]; for(int i = 0; i < n; i ++) scanf("%d", &a[i]); int pref[n]; pref[0] = a[0]; for(int i = 1; i < n; i ++) pref[i] = pref[i - 1] + a[i]; int q; scanf("%d", &q); while(q --) { int type; scanf("%d", &type); if(type == 1) { int asdf, gh, jkl; scanf("%d%d%d", &asdf, &gh, &jkl); continue; } int l, r, m; scanf("%d%d%d", &l, &r, &m); l --, r--; int ans = 0; for(int i = l; i <= r - m + 1; i ++) { ans += pref[i + m - 1] - (i - 1 < 0 ? 0 : pref[i-1]); } printf("%d\n", ans); } return 0; }

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

Main.cpp: In function 'int main()':
Main.cpp:5:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |  scanf("%d%d", &n, &k);
      |  ~~~~~^~~~~~~~~~~~~~~~
Main.cpp:7:35: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  for(int i = 0; i < n; i ++) scanf("%d", &a[i]);
      |                              ~~~~~^~~~~~~~~~~~~
Main.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  scanf("%d", &q);
      |  ~~~~~^~~~~~~~~~
Main.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   scanf("%d", &type);
      |   ~~~~~^~~~~~~~~~~~~
Main.cpp:18:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |    scanf("%d%d%d", &asdf, &gh, &jkl);
      |    ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:22:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |   scanf("%d%d%d", &l, &r, &m);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...