이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define ll long long
#define endl "\n"
#define Sara ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const long long mod=1e9+7;
const double PI=acos(-1);
// 1 2 3 --> 1,2,3 ...1,2..1,3..1..2,3..2..3..none (2 power number of elements)
//1 2 3 --> 2--> 1,2..1,3..2,3..(!n/(r!(n-r)!)) aka:ncr
// 1 2 3 -->2-->1,2..2,1..1,3..3,1..2,3..3,2..(n!/(n-r)!) aka:npr
//1 2 3--> 1..1,2..1,2,3..2..2,3..3 number of subarrays -->(n*(n+1))/2 "sum of numbers from 1 to n."
/*
ll power(ll x,ll y)
{
if(y==0)
return 1;
else if(y==1)
return x%mod;
ll r=power(x%mod,((y%mod)/2)%mod);
if(y%2==0)
return ((r%mod)*(r%mod));
else
return ((r%mod)*(r%mod)*(x%mod));
}
ll inverse(ll md,ll x)
{
return power(x%mod,mod-2);
}
*/
int main()
{
//freopen("input.in","r",stdin);
Sara
int n;
cin>>n;
vector<ll>v(n);
for(int i=0;i<n;i++) cin>>v[i];
int m=n-1;
while(m--){
int a,b;
cin>>a>>b;
}
ll sum=0;
for(int i=n;i>=2;i--){
sum+=(i+(i-1));
}
cout<<sum<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |