結果

問題 No.352 カード並べ
ユーザー naimonon77naimonon77
提出日時 2016-05-03 19:36:11
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 2,355 bytes
コンパイル時間 1,236 ms
コンパイル使用メモリ 164,816 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-05 05:11:46
合計ジャッジ時間 1,798 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 1 ms
5,248 KB
testcase_03 AC 1 ms
5,248 KB
testcase_04 AC 1 ms
5,248 KB
testcase_05 AC 2 ms
5,248 KB
testcase_06 AC 1 ms
5,248 KB
testcase_07 AC 1 ms
5,248 KB
testcase_08 AC 2 ms
5,248 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘void reader(char&)’:
main.cpp:21:31: warning: format ‘%c’ expects argument of type ‘char*’, but argument 2 has type ‘int’ [-Wformat=]
   21 | void reader(char &a){scanf(" %c",a);}
      |                              ~^  ~
      |                               |  |
      |                               |  int
      |                               char*
main.cpp: In function ‘void reader(int&)’:
main.cpp:18:26: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 | void reader(int &a){scanf("%d",&a);}
      |                     ~~~~~^~~~~~~~~
main.cpp: In function ‘void reader(double&)’:
main.cpp:19:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   19 | void reader(double &a){scanf("%lf",&a);}
      |                        ~~~~~^~~~~~~~~~
main.cpp: In function ‘void reader(char*)’:
main.cpp:20:28: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   20 | void reader(char a[]){scanf("%s",a);}
      |                       ~~~~~^~~~~~~~
main.cpp: In function ‘void reader(char&)’:
main.cpp:21:27: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 | void reader(char &a){scanf(" %c",a);}
      |                      ~~~~~^~~~~~~~~
main.cpp: In function ‘void reader(long long int&)’:
main.cpp:22:25: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   22 | void reader(ll &a){scanf("%lld",&a);}
      |                    ~~~~~^~~~~~~~~~~
main.cpp: In function ‘void reader(long long unsigned int&)’:
main.cpp:23:26: warning: ignoring return value of ‘int scanf(const char*, ...)�

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define SQR(X)  ( (X)*(X) )
#define CUBE(X) ( (X)*(X)*(X) )
#define ALL(a) (a).begin(),(a).end()
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;


void reader(int &a){scanf("%d",&a);}
void reader(double &a){scanf("%lf",&a);}
void reader(char a[]){scanf("%s",a);}
void reader(char &a){scanf(" %c",a);}
void reader(ll &a){scanf("%lld",&a);}
void reader(ull &a){scanf("%llu",&a);}
// void reader(string& a){cin >> a;};
template<class T,class U> void reader(T& t,U& u){reader(t); reader(u);}
template<class T,class U,class V> void reader(T& t,U& u,V& v){reader(t); reader(u); reader(v);}

void writer(int a,char c) {printf("%d",a); putchar(c);}
void writer(ll a,char c) {printf("%lld",a); putchar(c);}
void writer(ull a,char c) {printf("%llu",a); putchar(c);}
void writer(double a,char c) {printf("%.20lf",a); putchar(c);}
void writer(char a[]) {printf("%s",a);};
void writer(char a[],char c) {printf("%s",a);putchar(c);};
void writer(char a,char c) {putchar(a); putchar(c);};
template<class T>void writerLn(T t){writer(t,'\n');}
template<class T,class U>void writerLn(T t,U u){writer(t,' ');writer(u,'\n');}
template<class T,class U,class V> void writerLn(T t,U u,V v){writer(t,' ');writer(u,' ');writer(v,'\n');}
template<class T> void writerArr(T x[], int n){int i;if(!n){putchar('\n');return;}rep(i,n-1) writer(x[i],' ');writer(x[n-1],'\n');}
template<class T> void writerVec(vector<T> x){int n=x.size();int i;if(!n){putchar('\n');return;}rep(i,n-1) writer(x[i],' ');writer(x[n-1],'\n');}

vector<string> split(const string &str, char sep){vector<string> v;stringstream ss(str);string buffer;while(getline(ss,buffer,sep)){v.push_back(buffer);}return v;}

// #define int ll
bool test = 1;
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};
#define MAX 300000
//.....................
ll mod = (int)1e9+7;

signed main() {
  int i,j,k;
  int N;
  cin >> N;
  static double dp[30] = {0,1,2};

  REP(i,3,N+1) {
    int a = 0;
    REP(j,1,i) REP(k,1,i) {
      if(j == k) continue;
      a += j*k;
    }
    dp[i] = dp[i-1] \
      +(double)a/(i-1)/i \
            +2.0/i;
  }
  writerLn(dp[N]);
}
0