Skip to content

Commit

Permalink
problem(A1047): fix std
Browse files Browse the repository at this point in the history
  • Loading branch information
StableAgOH committed Jul 3, 2024
1 parent 2a19345 commit bb007d8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 26 deletions.
20 changes: 7 additions & 13 deletions problems/A/A1047/A1047.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# 输出格式

若结果为一个整数,直接输出这个整数;若结果为一个分数,输出分子和分母,中间用空格隔开
一行,一个浮点数,代表结果(保留 6 位小数)

# 输入输出样例

Expand All @@ -25,27 +25,21 @@
```

```output1
0
0.000000
```

```input2
2
```

```output2
1
```

```input3
42
```

```output3
65420941852673 549755813888
1.000000
```

# 说明/提示

对于 $40 \%$ 的数据,$1 \leq n \leq 20$。
对于 $30 \%$ 的数据,$1 \leq n \leq 10$。

对于 $50 \%$ 的数据,$1 \leq n \leq {10}^5$。

对于 $100 \%$ 的数据,$1 \leq n \leq 50$。
对于 $100 \%$ 的数据,$1 \leq n \leq {10}^9$。
6 changes: 4 additions & 2 deletions problems/A/A1047/gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ typedef uniform_int_distribution<> rnd;
typedef uniform_int_distribution<ll> rndll;
typedef uniform_real_distribution<> rndf;
mt19937 egn(time(nullptr));
const int CASES = 50;
const int CASES = 20;
// ==============================

// ==============================
Expand All @@ -15,7 +15,9 @@ int main(int argc, char const* argv[])
{
ofstream fout(to_string(_t)+".in");
// ==============================
fout<<_t<<endl;
if(_t<=6) fout<<10-_t+1<<endl;
else if(_t<=10) fout<<100000-_t+1<<endl;
else fout<<1000000000-_t+1<<endl;
// ==============================
fout.close();
}
Expand Down
14 changes: 3 additions & 11 deletions problems/A/A1047/std.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
#include <iostream>
#include <cmath>
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n;
double n;
cin>>n;
if(n==1) cout<<0<<endl;
else if(n==2) cout<<1<<endl;
else if(n==3) cout<<3<<endl;
else
{
long long tmp = pow(2, n-3);
cout<<3*(n-1)*tmp+1-tmp*4<<' '<<tmp<<endl;
}
cout<<fixed<<setprecision(6)<<(n-1)*(n-1)<<endl;
return 0;
}

0 comments on commit bb007d8

Please sign in to comment.