結果
| 問題 | 
                            No.959 tree and fire
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-01-21 11:14:51 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 575 bytes | 
| コンパイル時間 | 628 ms | 
| コンパイル使用メモリ | 68,352 KB | 
| 実行使用メモリ | 10,752 KB | 
| 最終ジャッジ日時 | 2024-07-05 04:56:30 | 
| 合計ジャッジ時間 | 4,241 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | -- * 3 | 
| other | AC * 1 TLE * 1 -- * 52 | 
ソースコード
#include<iostream>
#include<math.h>
#define REP(i,N) for(int i=0,__i=N;i<__i;++i)
long long N,M;
double P;
bool input(){
	using namespace std;
	cin>>N>>M;
	cin>>P;
	if(N<1||N>pow(10,9)||M<1||M>pow(10,9)||P<0||P>1)
		return false;
	return true;
}
double solve(){
	double sum_=0;
	int count;
	REP(i,N)
		REP(j,M){
		count=0;
		if(i>0)
			count++;
		if(i<N-1)
			count++;
		if(j>0)
			count++;
		if(j<M-1)
			count++;
		sum_+=P*pow(P,count);
		}
	return sum_;
}
int main(){
	using namespace std;
	if(!input())
		return -1;
	double res=solve();
	printf("%.10lf\n",res);
}