답안 #20642

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
20642 2017-02-13T06:22:31 Z 데굴데굴맹독충(#65, kjp4155) 채점 시스템 (OJUZ11_judge) C++14
100 / 100
49 ms 2208 KB
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll,ll> Pll;

#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define repp(i, n) for(int i=1;i<=n;i++)
#define all(x) x.begin(), x.end()

#define ABS(x) (((x) > 0 ) ? (x) : (-(x)))
#define MAX2(x, y) (((x) > (y)) ? (x) : (y))
#define MIN2(x, y) (((x) < (y)) ? (x) : (y))
#define MAX3(x, y, z) ( (x) > (y)  ? ( (x) > (z) ? (x) : (z)  ) : ( (y) > (z) ? (y) : (z) )  )
#define MIN3(x, y, z) ( (x) < (y)  ? ( (x) < (z) ? (x) : (z)  ) : ( (y) < (z) ? (y) : (z) )  )
#define MID3(val1,val2,val3) MAX2(MIN2(MAX2(val1,val2),val3),MIN2(val1,val2))


#define geti1(X) scanf("%d",&X)
#define geti2(X,Y) scanf("%d%d",&X,&Y)
#define geti3(X,Y,Z) scanf("%d%d%d",&X,&Y,&Z)
#define geti4(X,Y,Z,W) scanf("%d%d%d%d",&X,&Y,&Z,&W)

#define GET_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define geti(...) GET_MACRO(__VA_ARGS__, geti4, geti3, geti2, geti1) (__VA_ARGS__)

#define INF 987654321
#define IINF 987654321987654321

int N,M,K,T;
int getdigit(int x){
	int ret = 0;
	while(x>0){
		x/=10; ret++;
	}
	return ret;
}

int main(void){
	geti(T);
	while(T--){
		ll a,b; scanf("%lld%lld",&a,&b);
		int cnt = 0;
		int digit = getdigit(a);
		if( a == 0 ){
			printf("%d\n",getdigit(b)-1);
			continue;
		}
		while( true ){
			if( a + pow(10,cnt+digit) > b ){
				break;
			}
			cnt++;
		}
		printf("%d\n",cnt);
	}
}

Compilation message

judge.cpp: In function 'int main()':
judge.cpp:60:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  geti(T);
         ^
judge.cpp:62:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   ll a,b; scanf("%lld%lld",&a,&b);
                                  ^
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 2208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 2208 KB Output is correct
2 Correct 43 ms 2208 KB Output is correct
3 Correct 46 ms 2208 KB Output is correct
4 Correct 39 ms 2208 KB Output is correct
5 Correct 46 ms 2208 KB Output is correct
6 Correct 43 ms 2208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 2208 KB Output is correct
2 Correct 43 ms 2208 KB Output is correct
3 Correct 46 ms 2208 KB Output is correct
4 Correct 39 ms 2208 KB Output is correct
5 Correct 46 ms 2208 KB Output is correct
6 Correct 43 ms 2208 KB Output is correct
7 Correct 49 ms 2208 KB Output is correct
8 Correct 49 ms 2208 KB Output is correct
9 Correct 49 ms 2208 KB Output is correct
10 Correct 46 ms 2208 KB Output is correct
11 Correct 36 ms 2208 KB Output is correct