結果
| 問題 | No.212 素数サイコロと合成数サイコロ (2) |
| コンテスト | |
| ユーザー |
184
|
| 提出日時 | 2015-05-23 05:45:50 |
| 言語 | C++11(廃止可能性あり) (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 817 bytes |
| 記録 | |
| コンパイル時間 | 658 ms |
| コンパイル使用メモリ | 69,940 KB |
| 実行使用メモリ | 515,996 KB |
| 最終ジャッジ日時 | 2024-07-06 06:02:00 |
| 合計ジャッジ時間 | 2,198 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 9 MLE * 1 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:38:20: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘double’ [-Wformat=]
38 | printf("%lld.%.10f\n",sum/num+(double)(sum%num)/num );
| ~~~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| long long int double
| %f
main.cpp:38:26: warning: format ‘%f’ expects a matching ‘double’ argument [-Wformat=]
38 | printf("%lld.%.10f\n",sum/num+(double)(sum%num)/num );
| ~~~~^
| |
| double
main.cpp:16:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
16 | int p,c;scanf("%d%d",&p,&c);
| ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <queue>
#include <string>
#include <functional>
#include <iostream>
using namespace std;
//namaega184
int main(){
int p,c;scanf("%d%d",&p,&c);
int a[10]={2,3,5,7,11,13},b[10]={4,6,8,9,10,12};
int num=1;
for(int i=0;i<p+c;i++)num*=6;
vector<int> v;if(p){v.assign(a,a+6);p--;}
for(int i=0;i<p;i++){
vector<int> tmp;
for(int j=0;j<v.size();j++){
for(int k=0;k<6;k++)tmp.push_back(v[j]*a[k]);
}
v=tmp;
}
if(v.size()==0){v.assign(b,b+6);c--;}
for(int i=0;i<c;i++){
vector<int> tmp;
for(int j=0;j<v.size();j++){
for(int k=0;k<6;k++)tmp.push_back(v[j]*b[k]);
}
v=tmp;
}
long long sum=0;
for(int i=0;i<v.size();i++)sum+=v[i];
printf("%lld.%.10f\n",sum/num+(double)(sum%num)/num );
return 0;
}
184