Present.

2934

Miracle狼魂
L-China
Xtt_1

ヤ句号悠灬

Iamyou_9

Finn2009

akakakakakak
BT7274

You星星还在吗

#include<iostream>
using namespace std;

int a[100010];
int b[100010];

void insert(int l,int r,int c)
{
b[l] += c;
b[r + 1] -= c;
}

int main()
{
int n,m;
cin >> n >> m;
for(int i = 1;i <= n;i ++) cin >> a[i];
for(int i = 1;i <= n;i ++) insert(i,i,a[i]);
while(m --)
{
int a,b,c;
cin >> a >> b >> c;
insert(a,b,c);
}
for(int i = 1;i <= n;i ++)
{
b[i] += b[i - 1];
}
for(int i = 1;i <= n;i ++) cout << b[i] << " ";
return 0;
}


Present.
10天前
#include <iostream>
using namespace std;
const int N = 1e9,N1 = 1e5;
long long res = 1;

void func(long long a,long long b)
{
while(b)
{
res *= a;
b --;
}
}

int main()
{
long long n,m;
cin >> n >> m;
if(n < N && m == 1) res = n;
else if(n == 1) res = 1;
else if(n > N1 || m > N1)  res = N + 1;
else func(n,m);
if(res > N) cout << "-1" << endl;
else cout << res << endl;
return 0;
}


Present.
10天前
#include <iostream>
using namespace std;
const int N = 1e9,N1 = 1e5;
long long res = 1;

void func(long long a,long long b)
{
while(b)
{
res *= a;
b --;
}
}

int main()
{
long long n,m;
cin >> n >> m;
if(n < N && m == 1) res = n;
else if(n == 1) res = 1;
else if(n > N1 || m > N1)  res = N + 1;
else func(n,m);
if(res > N) cout << "-1" << endl;
else cout << res << endl;
return 0;
}


Present.
10天前
#include <bits/stdc++.h>
using namespace std;
int a[1000];

int main()
{
double n,a1;
double sum = 0,isum = 0;
cin >> n;
for(int i = 1;i <= n;i ++)
{
cin >> a[i];
sum += a[i];
}
a1 = sum / n;
for(int i = 1;i <= n;i ++)
{
isum += (1 / n) * (a[i] - a1) * (a[i] - a1);
}
for(int i = 1;i <= n;i ++)
{
cout << (a[i] - a1) / sqrt(isum) << endl;
}
return 0;
}


Present.
10天前
#include <bits/stdc++.h>
using namespace std;
int a[1000];

int main()
{
double n,a1;
double sum = 0,isum = 0;
cin >> n;
for(int i = 1;i <= n;i ++)
{
cin >> a[i];
sum += a[i];
}
a1 = sum / n;
for(int i = 1;i <= n;i ++)
{
isum += (1 / n) * (a[i] - a1) * (a[i] - a1);
}
for(int i = 1;i <= n;i ++)
{
cout << (a[i] - a1) / sqrt(isum) << endl;
}
return 0;
}


Present.
10天前
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

vector<pair<int,int>> v;
vector<int> v1;
int n,m;

bool cmp(pair<int,int> a,pair<int,int> b)
{
if(a.first != b.first) return a.first < b.first;
else return a.second < b.second;
}

int main()
{
cin >> n >> m;
for(int i = 1;i <= n;i ++)
{
int tmp = i;
int isum = 0;
while(tmp)
{
isum += tmp % 10;
tmp /= 10;
}
v.push_back({isum,i});
}
sort(v.begin(),v.end(),cmp);
for(auto c : v)
{
v1.push_back({c.second});
}
cout << v1[m - 1] << endl;
return 0;

}


Present.
10天前
#include <iostream>

using namespace std;
int res;

int main()
{
string s;
cin >> s;
int a,b,a1,b1,a2,b2,a3,b3,a4,b4,a5,b5,a6,b6,a7,b7,a8,b8,a9,b9;
a = 1189,b = 841;
a1 = b, b1 =  a / 2;
a2 = b1,b2 = a1 / 2;
a3=  b2,b3 = a2 / 2;
a4 = b3,b4 = a3 / 2;
a5 = b4,b5 = a4 / 2;
a6 = b5,b6 = a5 / 2;
a7 = b6,b7 = a6 / 2;
a8 = b7,b8 = a7 / 2;
a9 = b8,b9 = a8 / 2;
if(s == "A0") cout << a << endl << b;
if(s == "A1") cout << a1 << endl << b1;
if(s == "A2") cout << a2 << endl << b2;
if(s == "A3") cout << a3 << endl << b3;
if(s == "A4") cout << a4 << endl << b4;
if(s == "A5") cout << a5 << endl << b5;
if(s == "A6") cout << a6 << endl << b6;
if(s == "A7") cout << a7 << endl << b7;
if(s == "A8") cout << a8 << endl << b8;
if(s == "A9") cout << a9 << endl << b9;
return 0;
}


Present.
10天前
#include <iostream>

using namespace std;
int res;

int main()
{
string s;
cin >> s;
int a,b,a1,b1,a2,b2,a3,b3,a4,b4,a5,b5,a6,b6,a7,b7,a8,b8,a9,b9;
a = 1189,b = 841;
a1 = b, b1 =  a / 2;
a2 = b1,b2 = a1 / 2;
a3=  b2,b3 = a2 / 2;
a4 = b3,b4 = a3 / 2;
a5 = b4,b5 = a4 / 2;
a6 = b5,b6 = a5 / 2;
a7 = b6,b7 = a6 / 2;
a8 = b7,b8 = a7 / 2;
a9 = b8,b9 = a8 / 2;
if(s == "A0") cout << a << endl << b;
if(s == "A1") cout << a1 << endl << b1;
if(s == "A2") cout << a2 << endl << b2;
if(s == "A3") cout << a3 << endl << b3;
if(s == "A4") cout << a4 << endl << b4;
if(s == "A5") cout << a5 << endl << b5;
if(s == "A6") cout << a6 << endl << b6;
if(s == "A7") cout << a7 << endl << b7;
if(s == "A8") cout << a8 << endl << b8;
if(s == "A9") cout << a9 << endl << b9;
return 0;
}


Present.
10天前
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

vector<pair<int,int>> v;
vector<int> v1;
int n,m;

bool cmp(pair<int,int> a,pair<int,int> b)
{
if(a.first != b.first) return a.first < b.first;
else return a.second < b.second;
}

int main()
{
cin >> n >> m;
for(int i = 1;i <= n;i ++)
{
int tmp = i;
int isum = 0;
while(tmp)
{
isum += tmp % 10;
tmp /= 10;
}
v.push_back({isum,i});
}
sort(v.begin(),v.end(),cmp);
for(auto c : v)
{
v1.push_back({c.second});
}
cout << v1[m - 1] << endl;
return 0;

}


Present.
11天前
#include <iostream>
using namespace std;

long long a[200010];
long long s[200010];

int main()
{
int n;
long long sum = 0;
cin >> n;
for(int i = 1;i <= n;i ++)
{
cin >> a[i];
s[i] = s[i - 1] + a[i];
}
for(int i = 1;i < n;i ++)
{
sum += a[i] * (s[n] - s[i]);
}
cout << sum << endl;
return 0;
}