| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1362524 | Aviansh | Sequence (BOI23_sequence) | C++20 | 0 ms | 344 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
int w[n+1];
for(int i = 1;i<=n;i++){
cin >> w[i];
}
bool prime[n+1];
fill(prime,prime+n+1,1);
for(int i = 2;i<=n;i++){
if(prime[i]){
for(int j = i+i;j<=n;j+=i){
prime[j]=0;
}
}
}
for(int i = 1;i<=n;i++){
int lar = 1;
for(int j = 1;j<=i;j++){
if(prime[j]&&i%j==0){
lar=j;
}
}
//atleast till this have to go by +1s
int ans = lar;
int curnum = i;
int cn = 0;
for(int j = lar;j>1;j--){
int cnt = 0;
while(curnum%j==0){
cnt++;
curnum/=j;
}
if(cnt){
//need this power of j for making curnum
//how many additional for this?
int x = floor(log2(cnt));
int y = __builtin_popcount(cnt);
cn++;
ans+=x+y-1;
}
}
ans+=max(0LL,cn-1);
cout << ans << " ";
}
return 0;
}
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
