結果

問題 No.959 tree and fire
ユーザー kotatsugamekotatsugame
提出日時 2019-12-22 02:21:03
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 375 bytes
コンパイル時間 653 ms
コンパイル使用メモリ 69,736 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-13 10:05:42
合計ジャッジ時間 2,208 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<iomanip>
using namespace std;
long N,M;
double P;
main()
{
	cin>>N>>M>>P;
	cout<<fixed<<setprecision(16);
	if(N==1)
	{
		if(M==1)
		{
			cout<<P<<endl;
		}
		else
		{
			cout<<2*P*P+P*P*P*(M-2)<<endl;
		}
	}
	else if(M==1)
	{
		cout<<2*P*P+P*P*P*(N-2)<<endl;
	}
	else
	{
		cout<<4*P*P*P+P*P*P*P*(2*(N-2)+2*(M-2))+P*P*P*P*P*(N-2)*(M-2)<<endl;
	}
}
0