답안 #689642

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
689642 2023-01-29T03:50:33 Z Warinchai Trol (COCI19_trol) C++14
0 / 50
1000 ms 276 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
	int q;
	cin>>q;
	long long sum=0;
	long long a,b;
	long long dif;
	long long ii=0;
	for(int i=0;i<q;i++){
		cin>>a>>b;
		sum=0;
		int da=a%9;
		int db=b%9;
		dif=b-a+1;
		int ddd=dif/9;
		sum+=ddd*45;
		for(ii=a+ddd*9;i<=b;i++){
			int x=i%9;
			if(x==0){
				x=9;
			}
			sum+=x;
		}
		cout<<sum<<endl;
	}
}

Compilation message

trol.cpp: In function 'int main()':
trol.cpp:13:7: warning: unused variable 'da' [-Wunused-variable]
   13 |   int da=a%9;
      |       ^~
trol.cpp:14:7: warning: unused variable 'db' [-Wunused-variable]
   14 |   int db=b%9;
      |       ^~
trol.cpp:9:12: warning: variable 'ii' set but not used [-Wunused-but-set-variable]
    9 |  long long ii=0;
      |            ^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Execution timed out 1089 ms 212 KB Time limit exceeded
4 Incorrect 601 ms 276 KB Output isn't correct
5 Execution timed out 1093 ms 212 KB Time limit exceeded