Submission #49311301


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL
 #define debug(...) fprintf(stdout, ##__VA_ARGS__)
#else
 #define debug(...) void(0)
#endif
#define int long long
inline int read(){int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;
ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+
(x<<3)+(ch^48);ch=getchar();}return x*f;}
#define Z(x) (x)*(x)
#define pb push_back
#define fi first
#define se second
//#define M
//#define mo
//#define N
int n, m, i, j, k, T;

signed main()
{
	#ifdef LOCAL
	  freopen("in.txt", "r", stdin);
	  freopen("out.txt", "w", stdout);
	#endif
//	srand(time(NULL));
//	T=read();
//	while(T--) {
//
//	}
	n = m = read(); 
	if(n <= 5) return printf("%lld", (n - 1) * 2), 0; 
	for(i = 1, n -= 6, j = 5; ; ++i, j *= 5) {
//		debug("%lld : %lld %lld\n", n, j, 4 * j); 
		if(n <= 4 * j) {
			printf("%lld", (n / j + 1) * 2); n -= (n / j) * j; 
			while(i) j /= 5, printf("%lld", (n / j)* 2), n %= j, --i; 
			return 0; 
		}
		n -= 4 * j; 
	}
	return 0;
}

Submission Info

Submission Time
Task C - Even Digits
User zhangtingxi
Language C++ 20 (gcc 12.2)
Score 300
Code Size 1045 Byte
Status AC
Exec Time 1 ms
Memory 3808 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 13
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_small_00.txt, 01_small_01.txt, 01_small_02.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 03_max_00.txt, 04_min_00.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3692 KiB
00_sample_01.txt AC 1 ms 3772 KiB
00_sample_02.txt AC 1 ms 3588 KiB
01_small_00.txt AC 1 ms 3792 KiB
01_small_01.txt AC 1 ms 3780 KiB
01_small_02.txt AC 1 ms 3744 KiB
02_random_00.txt AC 1 ms 3668 KiB
02_random_01.txt AC 1 ms 3688 KiB
02_random_02.txt AC 1 ms 3744 KiB
02_random_03.txt AC 1 ms 3780 KiB
02_random_04.txt AC 1 ms 3808 KiB
03_max_00.txt AC 1 ms 3776 KiB
04_min_00.txt AC 1 ms 3572 KiB