update
This commit is contained in:
parent
18e35e91d7
commit
b158ca18fc
4
.vscode/settings.json
vendored
Normal file
4
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"python.analysis.autoImportCompletions": true,
|
||||
"python.analysis.typeCheckingMode": "strict"
|
||||
}
|
29
src/2/P2719.cpp
Normal file
29
src/2/P2719.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <iomanip>
|
||||
#include <ios>
|
||||
#include <iostream>
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
|
||||
using ll = int64_t;
|
||||
const ll maxn = 1250;
|
||||
double dp[maxn+5][maxn+5];
|
||||
|
||||
int main(){
|
||||
std::iostream::sync_with_stdio(false),std::cin.tie(nullptr),std::cout.tie(nullptr);
|
||||
|
||||
const ll n = []()->ll{ll n;std::cin>>n;return n/2;}();
|
||||
for(ll i=2;i<=n;i++){
|
||||
dp[i][0]=dp[0][i]=1.0;
|
||||
}
|
||||
for(ll i=1;i<=n;i++){
|
||||
for(ll j=1;j<=n;j++){
|
||||
dp[i][j]=(dp[i-1][j]+dp[i][j-1])/2;
|
||||
}
|
||||
}
|
||||
|
||||
std::cout<<std::fixed<<std::setprecision(4)<<dp[n][n]<<'\n';
|
||||
std::flush(std::cout);
|
||||
quick_exit(0);
|
||||
}
|
72
src/2/P3390.cpp
Normal file
72
src/2/P3390.cpp
Normal file
@ -0,0 +1,72 @@
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
|
||||
using ll = int64_t;
|
||||
|
||||
const ll p = 1e9+7;
|
||||
template<class T>
|
||||
T input(){
|
||||
T t;
|
||||
std::cin>>t;
|
||||
return t;
|
||||
}
|
||||
ll n=input<ll>(),k=input<ll>();
|
||||
void fnn(std::function<void(ll,ll)> func,std::function<void()> f = [](){}){
|
||||
for(ll i=1;i<=n;i++){
|
||||
for(ll j=1;j<=n;j++){
|
||||
func(i,j);
|
||||
}
|
||||
f();
|
||||
}
|
||||
}
|
||||
struct Mat{
|
||||
std::vector<std::vector<ll>> vec;
|
||||
Mat():vec(n+1,std::vector<ll>(n+1,0)){
|
||||
|
||||
}
|
||||
Mat&setid(){
|
||||
for(ll i=1;i<=n;i++){
|
||||
vec[i][i]=1;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
Mat operator*(Mat&that){
|
||||
Mat res;
|
||||
for(ll i=1;i<=n;i++){
|
||||
for(ll j=1;j<=n;j++){
|
||||
for(ll k=1;k<=n;k++){
|
||||
res.vec[i][j] = (res.vec[i][j] + vec[i][k]*that.vec[k][j]%p)%p;
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Mat a;
|
||||
Mat mfp(){
|
||||
Mat res;
|
||||
res.setid();
|
||||
while(k){
|
||||
if(k&1)res=res*a;
|
||||
a=a*a;
|
||||
k/=2;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int main(){
|
||||
fnn([&](ll i,ll j){
|
||||
std::cin>>a.vec[i][j];
|
||||
});
|
||||
const Mat res = mfp();
|
||||
fnn([&](ll i,ll j){
|
||||
std::cout<<res.vec[i][j]<<' ';
|
||||
},[](){
|
||||
std::cout<<'\n';
|
||||
});
|
||||
}
|
7
src/2/P3390.py
Normal file
7
src/2/P3390.py
Normal file
@ -0,0 +1,7 @@
|
||||
import re
|
||||
import sys
|
||||
|
||||
stdin:str = sys.stdin.read()
|
||||
|
||||
lines = re.split(r"\s+",stdin.strip())
|
||||
|
Loading…
Reference in New Issue
Block a user