結果

問題 No.1274 楽しい格子点
ユーザー umezoumezo
提出日時 2020-10-30 23:40:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 877 bytes
コンパイル時間 2,030 ms
コンパイル使用メモリ 200,032 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-29 08:42:27
合計ジャッジ時間 4,303 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 WA -
testcase_03 AC 1 ms
4,380 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 1 ms
4,380 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 1 ms
4,380 KB
testcase_38 AC 2 ms
4,380 KB
testcase_39 AC 1 ms
4,380 KB
testcase_40 AC 1 ms
4,380 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 1 ms
4,376 KB
testcase_43 AC 1 ms
4,380 KB
testcase_44 AC 1 ms
4,376 KB
testcase_45 AC 1 ms
4,380 KB
testcase_46 AC 1 ms
4,380 KB
testcase_47 AC 2 ms
4,376 KB
testcase_48 AC 1 ms
4,376 KB
testcase_49 WA -
testcase_50 AC 1 ms
4,376 KB
testcase_51 AC 2 ms
4,376 KB
testcase_52 AC 2 ms
4,380 KB
testcase_53 WA -
testcase_54 AC 1 ms
4,380 KB
testcase_55 WA -
testcase_56 WA -
testcase_57 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main(){
  ll a,b;
  cin>>a>>b;
  
  if(a<0) a=-a;
  if(b<0) b=-b;
  if(a>100) a=0;
  if(b>100) b=0;
  int g=gcd(a,b);
  
  ll x=1,y=1;
  if(a==0 && b==0) cout<<0.25<<endl;
  else if(a==0){
    double ans=0;
    for(int i=1;i<100;i++){
      if((i-1)%b==0) ans+=1/pow(1+i,1+i);
      y+=b;
    }
    cout<<fixed<<setprecision(10)<<ans<<endl;
  }
  else if(b==0){
    double ans=0;
    for(int i=1;i<100;i++){
      if((i-1)%a==0) ans+=1/pow(i+1,i+1);
    }
    cout<<fixed<<setprecision(10)<<ans<<endl;
  }
  else{
    double ans=0;
    for(int i=0;i<=10;i++){
      for(int j=0;j<=10;j++){
        ans+=1.0/pow(2+g*(i+j),2+g*(i+j));
      }
    }
    
    cout<<fixed<<setprecision(10)<<ans<<endl;
  }

  return 0;
}
0