結果
| 問題 | No.3692 Calculate Mu |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-06 18:07:50 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 4 ms / 2,000 ms |
| + 249µs | |
| コード長 | 414 bytes |
| 記録 | |
| コンパイル時間 | 1,024 ms |
| コンパイル使用メモリ | 172,756 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-09-06 18:08:08 |
| 合計ジャッジ時間 | 2,040 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
int mu_naive(ll n){
if(n==1) return 1;
int ans=1;
for(ll i=2; i*i<=n; i++){
if(n%i) continue;
int c=0;
while(n%i==0){
c++, n/=i;
}
if(c>=2) return 0;
ans*=-1;
}
if(n>1) ans*=-1;
return ans;
}
int main(void){
ll n; cin >> n;
cout << mu_naive(n) << endl;
return 0;
}