結果
問題 |
No.212 素数サイコロと合成数サイコロ (2)
|
ユーザー |
![]() |
提出日時 | 2015-05-23 05:43:24 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,141 bytes |
コンパイル時間 | 771 ms |
コンパイル使用メモリ | 85,444 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-06 06:01:18 |
合計ジャッジ時間 | 1,282 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 10 |
コンパイルメッセージ
main.cpp: In function ‘int solve()’: main.cpp:26:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 26 | scanf("%d%d%d",&r,&c,&w); | ~~~~~^~~~~~~~~~~~~~~~~~~ main.cpp: In function ‘int main()’: main.cpp:57:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 57 | freopen("R:\\a.in","r",stdin); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ main.cpp:58:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 58 | freopen("R:\\a.out","w",stdout); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ main.cpp:60:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 60 | scanf("%d",&n); | ~~~~~^~~~~~~~~
ソースコード
#include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <tuple> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cstring> #include <cmath> #include <cstdlib> #include <ctime> using namespace std; int solve(){ int r,c,w; scanf("%d%d%d",&r,&c,&w); int ans=0; if(c==w){printf("%d\n",c);return 0;} if(w==1){printf("%d\n",r*c);return 0;} for(int i=w-1;i <c; i+=w){ ans++; if(i+w>=c ){ int ans2; int a=w+c-1-i; ans*=r; ans2=1; ans+=a-w+w-1; int b=min(w+w-1,c) ; ans2+=b-w+w-1; printf("%d\n",max(ans,ans2)); return 0; } /* if(i+w+w-1<c)i+=w+w-1; else{i+=w;}*/ } printf("%d\n",ans); //printf("%d\n",ans); ans*=r; ans+=w-1; //printf("%d\n",ans); printf("%d\n",ans+1); return 0; } int main(){ freopen("R:\\a.in","r",stdin); freopen("R:\\a.out","w",stdout); int n; scanf("%d",&n); for(int i=1;i<=n;i++){ //printf("Case #%d: %f\n",solvea()); printf("Case #%d: ",i); solve (); } return 0; }