Submission #2859576
Source Code Expand
#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <queue>
#include <stack>
#include <deque>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = (int)(a);(i) > (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, n) &((x)[0]), &((x)[n])
#define ADD(a, b) ((((a)%MOD)+((b)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define FLOOR(x) ((int)floor(((double)x)))
#define CEIL(x) ((int)ceil(((double)x)))
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mt make_tuple
#define fi first
#define se second
#define EPS (1e-20)
#define INF 2147483647
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using VLL = std::vector<llint>;
using MCI = std::map<char, int>;
using namespace std;
int K;
int S(llint n){
int sum = 0;
do {
sum += n%10;
} while(n/=10);
return sum;
}
double snukeV(llint n){
return (double)n/S(n);
}
void solve(){
VLL ans;
llint base = 1;
rep(i, 0, 15){
rep(j, 1, 150){
ans.pb(base*(j+1)-1);
}
base *= 10;
}
sort(ALL(ans));
ans.erase(unique(ALL(ans)), ans.end());
rep(i, 0, SIZE(ans)){
rep(j, i+1, SIZE(ans)){
if(snukeV(ans[i]) > snukeV(ans[j])){ ans.erase(ans.begin()+i--); break; }
}
}
rep(i, 0, K) cout << ans[i] << endl;
}
signed main(){
cin >> K;
solve();
return 0;
}
Submission Info
Submission Time |
|
Task |
D - Snuke Numbers |
User |
AqFv |
Language |
C++14 (GCC 5.4.1) |
Score |
500 |
Code Size |
2195 Byte |
Status |
AC |
Exec Time |
35 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 |
35 ms |
256 KB |
sample.txt |
AC |
34 ms |
256 KB |