結果

問題 No.212 素数サイコロと合成数サイコロ (2)
ユーザー 184184
提出日時 2015-05-23 05:43:24
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,141 bytes
コンパイル時間 723 ms
コンパイル使用メモリ 86,376 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-20 10:33:18
合計ジャッジ時間 1,384 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
} 
0