結果
| 問題 |
No.959 tree and fire
|
| コンテスト | |
| ユーザー |
mighty-isuka
|
| 提出日時 | 2020-01-24 16:17:07 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 804 bytes |
| コンパイル時間 | 2,283 ms |
| コンパイル使用メモリ | 167,164 KB |
| 実行使用メモリ | 13,880 KB |
| 最終ジャッジ日時 | 2024-09-14 03:43:07 |
| 合計ジャッジ時間 | 8,281 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 3 TLE * 1 -- * 50 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
long N,M;
cin>>N>>M;
cout <<fixed<< setprecision(10) ;
double p;
cin>>p;
double t=0;
if(N>1&&M>1){
for(int i=0;i<N;i++){
for(int j=0;j<M;j++){
int lp=1;
if(i==0)lp++;
else if(i==N-1)lp++;
else lp+=2;
if(j==0)lp++;
else if(j==M-1)lp++;
else lp+=2;
t+=pow(p,lp);
}
}
cout<<t<<endl;
}else if(N==1&&M==1) cout<<p<<endl;
else{
int m=max(N,M);
for(int i=0;i<m;i++){
double pl=p;
if(i==0||i==m-1)pl=pl*p;
else pl=pl*p*p;
t+=pl;
}
cout<<t<<endl;
}
}
mighty-isuka