Submission #3608852
Source Code Expand
#include<bits/stdc++.h> using namespace std; typedef long long ll; ll f ( ll x ) { if ( x == 0 ) return 0; else return x % 10 + f ( x / 10 ); } int main() { std::ios::sync_with_stdio ( false ); int k; cin >> k; int num = 0; ll ans = 1; ll p = 1; while ( num < k ) { cout << ans << endl; ll ans1 = ans + p; ll ans2 = ans + p * 10; if ( ans1 * f ( ans2 ) <= ans2 * f ( ans1 ) ) { ans = ans1; } else { ans = ans2; p *= 10; } num++; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Snuke Numbers |
User | vjudge4 |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 579 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 500 / 500 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample.txt |
All | sample.txt, 1.txt, sample.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
1.txt | AC | 2 ms | 256 KB |
sample.txt | AC | 1 ms | 256 KB |