Submission #3608857
Source Code Expand
#include <cstdio>
#include <cstring>
#include <queue>
#include <cmath>
#include <algorithm>
#include <set>
#include <iostream>
#include <map>
#include <stack>
#include <string>
#include <vector>
#define pi acos(-1.0)
#define eps 1e-6
#define fi first
#define se second
#define rtl rt<<1
#define rtr rt<<1|1
#define bug printf("******\n")
#define mem(a,b) memset(a,b,sizeof(a))
#define name2str(x) #x
#define fuck(x) cout<<#x" = "<<x<<endl
#define f(a) a*a
#define sf(n) scanf("%d", &n)
#define sff(a,b) scanf("%d %d", &a, &b)
#define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define sffff(a,b,c,d) scanf("%d %d %d %d", &a, &b, &c, &d)
#define pf printf
#define FRE(i,a,b) for(i = a; i <= b; i++)
#define FREE(i,a,b) for(i = a; i >= b; i--)
#define FRL(i,a,b) for(i = a; i < b; i++)+
#define FRLL(i,a,b) for(i = a; i > b; i--)
#define FIN freopen("data.txt","r",stdin)
#define gcd(a,b) __gcd(a,b)
#define lowbit(x) x&-x
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 10;
const int INF = 0x3f3f3f3f;
const LL INFLL = 0x3f3f3f3f3f3f3f3fLL;
int k;
LL sum ( int x ) {
LL ret = 0;
while ( x ) {
ret += x % 10;
x /= 10;
}
return ret;
}
int main() {
sf ( k );
LL ans = 1, p = 1;
while ( k-- ) {
printf ( "%lld\n", ans );
LL ans1 = ans + p, ans2 = ans + p * 10;
if ( ans1 * sum ( ans2 ) <= ans2 * sum ( ans1 ) ) ans = ans1;
else ans = ans2,p*=10;
}
return 0;
}
Submission Info
Submission Time
2018-11-16 23:16:32+0900
Task
D - Snuke Numbers
User
vjudge3
Language
C++14 (GCC 5.4.1)
Score
0
Code Size
1597 Byte
Status
WA
Exec Time
1 ms
Memory
256 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:52:13: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
sf ( k );
^
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
0 / 500
Status
Set Name
Test Cases
Sample
sample.txt
All
sample.txt, 1.txt, sample.txt
Case Name
Status
Exec Time
Memory
1.txt
WA
1 ms
256 KB
sample.txt
AC
1 ms
256 KB