- #include <bits/stdc++.h>
- using namespace std;
- vector<int> v[1006];
- int a[1000];
- void preprocess(){
- for(int i = 1; i <1006; i++){
- for(int j = i; j <1006; j+= i){
- v[j].push_back(i);
- }
- }
- /*
- for(int i = 1; i <=1000; i++){
- for(int j = 0; j <v[i].size(); j++){
- cout<<v[i][j]<<" ";
- }
- cout<<endl;
- }
- */
- }
- bool comp(int a, int b){
- return ((v[a].size()<v[b].size()) ||((v[a].size()==v[b].size())&&(a>b)));
- }
- int main(){
- preprocess();
- //cout<<"comes";
- for(int i = 1; i <=1000; i++){
- a[i-1] = i;
- }
- sort(a, a+1000, comp);
- //for(int i = 0; i <1000; i++) cout<<a[i]<<" ";
- int ts;
- cin>>ts;
- for(int i = 1; i <=ts; i++){
- int n;
- scanf("%d", &n);
- printf("Case %d: %d\n", i, a[n-1]);
- }
- return 0;
- }
Friday 28 July 2017
Lightoj 1109 - False Ordering
Subscribe to:
Post Comments (Atom)
Most Featured Post
Lightoj 1159 - Batman
http://lightoj.com/volume_showproblem.php?problem=1159 problem analysis: First i thought of this as if s1, s2 and s3 are those three str...
-
Problem link: Problem Analysis: It is actually a basic Bisection problem , as we can see here we can not actually find a formula fo...
-
http://lightoj.com/volume_showproblem.php?problem=1382 Problem analysis: This is a rare problem i wrote about so far. After much strugg...
No comments:
Post a Comment