結果
| 問題 |
No.1491 銀将
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-02 21:25:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 2,822 bytes |
| コンパイル時間 | 9,342 ms |
| コンパイル使用メモリ | 410,720 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-30 11:39:09 |
| 合計ジャッジ時間 | 8,569 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/number.hpp>
using namespace boost::multiprecision;
using mint=modint1000000007;
#define tpf typedef
tpf double db;tpf long long ll;
tpf string str;tpf vector<ll> vll;
tpf vector<str> vs;tpf pair<ll,ll> pll;
tpf vector<pll> vpll;tpf vector<vll> vvll;
tpf cpp_int cp;tpf complex<db> com;
tpf vector<bool> vb;
int a,b;
#define For(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) For(i,0,n)
#define F first
#define S second
#define psf push_front
#define psb push_back
#define epb emplace_back
#define mkp make_pair
#define All(x) x.begin(),x.end()
#define Alld(x) All(x),greater<>()
#define nxp next_permutation
#define sep setprecision
#define lob lower_bound
const int mod = 1000000007;const ll INF=1e17;
const db pi=acos(-1);
const int di[]={-1,0,1,0};
const int dj[]={0,-1,0,1};
ll gcd(ll x,ll y){return y? gcd(y,x%y):x;}
ll ncr(ll n,ll r){
ll x=1,y=1;rep(i,r){x*=(n-i);y*=(i+1);}
return x/y;
}
ll pncr(ll n,ll r){
vvll v(n+1,vll(n+1));v[0][0]=1;
rep(i,n)rep(j,i+1){
v[i+1][j]+=v[i][j];
v[i+1][j+1]+=v[i][j];
}
return v[n][r];
}
template<class T> inline bool chmin(T& a, T b){
if(a>b){a=b;return true;}return false;
}
template<class T> inline bool chmax(T& a, T b){
if(a<b){a=b;return true;}return false;
}
ll to_base(ll n,ll i){
string s;
while(n){s=to_string(n%i)+s;n/=i;}
ll a=stoll(s);return a;
}
ll prime(ll n){
if(n==2)return 1;
if(n%2==0||n==1)return 0;
for(ll i=3;i*i<=n;i+=2)if(n%i==0)return 0;
return 1;
}
vll divisor(ll n){
vll a;
for(ll i=1;i*i<=n;i++){
if(n%i==0){
a.psb(i);if(i!=n/i)a.psb(n/i);
}
}
sort(All(a));return a;
}
vector<pair<ll,ll>> prifac(ll n){
vector<pair<ll,ll>> a;
for(ll i=2;i*i<=n;i++){
if(n%i!=0){continue;}ll exp=0;
while(n%i==0){n/=i;exp++;}
a.psb(pll(i,exp));
}
if(n!=1){a.psb(pll(n,1));}return a;
}
vll cumsum(vll a){
ll sz=a.size();
vll dp(sz+1);
rep(i,sz)dp[i+1]=dp[i]+a[i];
return dp;
}
vll eratos(ll n){
vll f(n+1),p;
rep(i,n+1)f[i]=1;
For(i,2,n+1){
if(f[i]){
for(ll j=2*i;j<=n;j+=i)f[j]=0;
p.psb(i);
}
}
return p;
}
vll eratos2(vll a,ll n){
vb x(n),ok(n,true);vll p,res;
for(ll i:a)x[i]=true;
For(i,2,n){
bool f=false;
for(ll j=i;j<n;j+=i)if(x[j])f=true;
if(f)p.psb(i);
}
for(ll i:p){
for(ll j=i;j<n;j+=i){
ok[j]=false;
}
}
For(i,1,n)if(ok[i])res.psb(i);
return res;
}
ll eulerf(ll n){
vll v(1);v[0]=n;
vll res=eratos2(v,n+1);
return res.size();
}
ll eulerf2(ll n){
vpll a=prifac(n);ll res=n;
for(auto i:a){res*=i.F-1;res/=i.F;}
return res;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
ll x;cin>>x;
cout<<(2*x+1)*2*x-(x-1)*2;
return 0;
}