답안 #975953

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
975953 2024-05-06T03:54:43 Z vjudge1 Trol (COCI19_trol) C++17
0 / 50
343 ms 524288 KB
#include <bits/stdc++.h>
#define int long long
#define ld long double
using namespace std;
const int N=1e9;

signed main(){
    int angka[N];
    for (int i=1;i<=N;i++){
        angka[i]=i;
    }
    int a; cin>>a;
    for(int i=0;i<a;i++){
        int x,y,ans=0; cin>>x>>y;
        if(x>y){
            return 0;
        }
        for(int j=x;j<=y;j++){
            int wawo;
            wawo=angka[j]%9;
            ans+=wawo;
        }
        cout<<ans<<endl;
    }
}

Compilation message

trol.cpp: In function 'int main()':
trol.cpp:10:17: warning: iteration 999999999 invokes undefined behavior [-Waggressive-loop-optimizations]
   10 |         angka[i]=i;
      |         ~~~~~~~~^~
trol.cpp:9:19: note: within this loop
    9 |     for (int i=1;i<=N;i++){
      |                  ~^~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 343 ms 524288 KB Execution killed with signal 9
2 Runtime error 268 ms 524288 KB Execution killed with signal 9
3 Runtime error 253 ms 524288 KB Execution killed with signal 9
4 Runtime error 264 ms 524288 KB Execution killed with signal 9
5 Runtime error 252 ms 524288 KB Execution killed with signal 9