이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("Ofast,unroll-loops")
#include<bits/stdc++.h>
//#define int long long
//#define ll long long
#define down cout<<'\n';
#define debug cout<<" cucuucucuuu",down
#define NHP ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
#define modwwe int t;cin>>t; while(t--)
#define bit(i,j) (i>>j&1)
#define sobit(a) __builtin_popcountll(a)
#define task "test"
#define fin(x) freopen(x".inp","r",stdin)
#define fou(x) freopen(x".ans","w",stdout)
#define pb push_back
#define checktime cerr << (double)clock() / CLOCKS_PER_SEC * 1000 << " ms";
using namespace std;
void phongbeo();
const int inf=1e9;
const int mod2=1e9+7;
const int mod1=998244353;
struct icd
{
long double a;
int b;
};
struct ib
{
int a;
int b;
};
struct ic
{
int a,b,c;
};
struct id
{
int a,b,c,d;
};
struct ie
{
int a,b,c,d,e;
};
int n,m,s1,s2,s4,s3,sf,k,s5,s6,mx,s7,s8,s9,mx2,res,dem2=0,dem=0,s33,dem3,l,r,mid;
int i,s10,s12;
int kk;
int el=29;
main()
{
#ifndef ONLINE_JUDGE
//fin(task),fou(task);
#endif
NHP
/// cin>>s1;
// modwwe
phongbeo();
}
vector <unordered_set<int>> dp;
vector <int> v;
void phongbeo()
{
cin>>n;
for(int i=1;i<=sqrt(n);i++)
{
if(n%i==0)
{
if(i!=n/i) v.pb(n/i);
v.pb(i);
}
}
m=v.size();
sort(v.begin(),v.end());
dp.resize(m);
dp[0].insert(0);
for(int i=1;i<v.size();i++)
for(int j=0;j<i;j++)
if(v[i]%v[j]==0)
for(auto x:dp[j])
dp[i].insert(x+v[i]/v[j]-1);
cout<<dp[m-1].size(),down
vector<int>v2;
for(auto x:dp[m-1])
v2.pb(x);
sort(v2.begin(),v2.end());
for(auto x:v2)
cout<<x<<" ";
}
컴파일 시 표준 에러 (stderr) 메시지
toy.cpp:50:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
50 | main()
| ^~~~
toy.cpp: In function 'void phongbeo()':
toy.cpp:77:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
77 | for(int i=1;i<v.size();i++)
| ~^~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |