結果
問題 | No.1727 [Cherry 3rd Tune] Stray |
ユーザー | chocorusk |
提出日時 | 2021-09-13 21:49:00 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 2 ms / 6,000 ms |
コード長 | 1,531 bytes |
コンパイル時間 | 10,491 ms |
コンパイル使用メモリ | 306,872 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-04-16 13:36:35 |
合計ジャッジ時間 | 11,056 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 2 ms
5,376 KB |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 2 ms
5,376 KB |
testcase_07 | AC | 2 ms
5,376 KB |
ソースコード
#include "testlib.h" #include <cstdio> #include <cstring> #include <iostream> #include <string> #include <cmath> #include <bitset> #include <vector> #include <map> #include <set> #include <queue> #include <deque> #include <algorithm> #include <complex> #include <unordered_map> #include <unordered_set> #include <random> #include <cassert> #include <fstream> #include <utility> #include <functional> #include <time.h> #include <stack> #include <array> #include <list> #include <atcoder/all> #define popcount __builtin_popcount using namespace std; using namespace atcoder; typedef long long ll; typedef pair<int, int> P; const int MAXN=10; const int MAXT=1; const int MAXC=2; int main(int argc, char* argv[]){ registerValidation(argc, argv); int t=inf.readInt(1, MAXT); inf.readEoln(); while(t--){ int n=inf.readInt(3, MAXN); inf.readSpace(); int c=inf.readInt(2, MAXC); inf.readEoln(); vector<int> vd; for(int i=1; i*i<=n; i++){ if(n%i==0){ vd.push_back(i); if(i*i<n) vd.push_back(n/i); } } sort(vd.begin(), vd.end()); int m=vd.size(); vector<int> vc(m); int ans=(1<<n)*n; for(int i=m-1; i>=0; i--){ vc[i]=n/vd[i]; for(int j=i+1; j<m; j++){ if(vd[j]%vd[i]==0) vc[i]-=vc[j]; } ans+=(1<<(2*vd[i]))*vc[i]; } ans/=(2*n); cout<<ans<<endl; } inf.readEof(); return 0; }