mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
7a5dfb949b
3000-3099
35 lines
724 B
C++
35 lines
724 B
C++
#include <cstdio>
|
|
int solve( int start , int i) {
|
|
int times = 1,s;
|
|
if(start == 1) times = 15;
|
|
else if(start == 2) times = 150;
|
|
else {
|
|
times = 750;
|
|
start = start - 3;
|
|
while(start--) {
|
|
times *= 10;
|
|
}
|
|
}
|
|
if(start == 2) {
|
|
if( i % 4 == 0)
|
|
s = (i + i/4 - 1)*times;
|
|
else
|
|
s = (i + i/4)*times;
|
|
} else {
|
|
if( i % 9 == 0)
|
|
s = (i + i/9 - 1)*times;
|
|
else
|
|
s = (i + i/9)*times;
|
|
}
|
|
return s;
|
|
}
|
|
int main(void) {
|
|
int T,m,k;
|
|
scanf("%d",&T);
|
|
while(T--) {
|
|
scanf("%d %d",&m,&k);
|
|
printf("%d\n",solve(m,k));
|
|
}
|
|
return 0;
|
|
}
|