結果

問題 No.212 素数サイコロと合成数サイコロ (2)
コンテスト
ユーザー 184
提出日時 2015-05-23 05:43:24
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,141 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 547 ms
コンパイル使用メモリ 106,880 KB
実行使用メモリ 15,816 KB
最終ジャッジ日時 2026-03-27 17:04:30
合計ジャッジ時間 15,582 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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