답안 #425438

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
425438 2021-06-13T03:55:41 Z errorgorn 나머지들의 합 (NOI12_modsum) C++17
25 / 25
78 ms 332 KB
#include <cstdio>
using namespace std;
int n,arr[1005][2],k;
void loop(int i,int v){
  if (i==n) {
    v=(v*v)%5;
    k+=(((v+2)*v)%5)+1;
  }
  else{
  for (int x=arr[i][0];x<=arr[i][1];x++){
    loop(i+1,(v+x)%5);
  }
  }
}
int main(){
  scanf("%d",&n);
  for (int x=0;x<n;x++){
    scanf("%d%d",&arr[x][0],&arr[x][1]);
  }
  loop(0,0);
  printf("%d",k);
}

Compilation message

modsum.cpp: In function 'int main()':
modsum.cpp:16:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |   scanf("%d",&n);
      |   ~~~~~^~~~~~~~~
modsum.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |     scanf("%d%d",&arr[x][0],&arr[x][1]);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 264 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 272 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 276 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 3 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 3 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 6 ms 284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 24 ms 332 KB Output is correct
4 Correct 1 ms 284 KB Output is correct
5 Correct 78 ms 332 KB Output is correct