ssyyg11

3228

yyz_hard

6_2

KGk
ཌༀཉ慕辰ༀད

WA声闹彻明
AcWingYyyyyy
joker略

ylz
violet_garden

ssyyg11
1天前
#include<iostream>
#include<algorithm>
#include<cstring>
#include<sstream>
using namespace std;

const int N = 10010;
int a[N];
int n;

int main()
{
int cnt;
cin >> cnt;

string line;
getline(cin, line);

while(cnt --)
{
getline(cin, line);
stringstream ssin(line);
while(ssin >> a[n]) n ++;
}
sort(a, a + n);

int res1, res2;
for(int i = 1; i < n; i ++)
if(a[i] == a[i - 1]) //找到重复的点
res2 = a[i];
else if(a[i] >= a[i - 1] + 2) res1 = a[i] - 1;
cout << res1 << ' ' << res2 << endl;
return 0;
}


ssyyg11
1天前
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;

LL res;
const int N = 100010;
int a[N], b[N], c[N];

int main()
{
int n;
cin >> n;

for(int i = 0; i < n; i ++) cin >> a[i];
for(int i = 0; i < n; i ++) cin >> b[i];
for(int i = 0; i < n; i ++) cin >> c[i];

for(int i = 0; i < n; i ++)
for(int j = 0; j < n; j ++)
for(int k = 0; k < n; k ++)
{
if(a[i] < b[j] && b[j] < c[k])
res ++;
}

cout << res;
return 0;
}


ssyyg11
1天前
#include<cstring>
#include<algorithm>
#include<iostream>
using  namespace std;

const int N = 55;

int n;
int x[N];

int main()
{
cin >> n;

for(int i = 0; i < n; i ++)
cin >> x[i];

int left = 0, right = 0;
for(int i = 1; i < n; i ++)
if(abs(x[i]) < abs(x[0]) && x[i] > 0) left ++;
else if(abs(x[i]) > abs(x[0]) && x[i] < 0) right ++;

if(x[0] > 0 && right == 0 || x[0] < 0 && left == 0) cout << 1 << endl;
else cout << right + left + 1;
return 0;
}


ssyyg11
1天前
#include<iostream>
using namespace std;

const int N = 100010;
int q[N], s[N];
int main()
{
int n, m;
cin >> n >> m;

for(int i = 1; i <= n; i ++)
{
cin >> q[i];
s[i] += s[i - 1] + q[i];
}

while(m --)
{
int a, b;
cin >> a >> b;

cout << s[b] - s[a - 1] << endl;
}
return 0;
}


ssyyg11
2天前
/*#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long LL;
const int N = 1e7 + 10;
int n, m;
int q[N];

int main()
{
cin >> n >> m;

for(int i = 1; i <= 1000; i ++)
for(int j = 1; j <= 1000; j ++)
{
q[i] = n * i + j * m;
}

sort(q, q + 1010);

for(int i = 0; i < N; i ++)
cout << q[i] << ' ';

for(int i = N; i >= 0; i --)
{
if(q[i] - 1 != q[i - 1])
{
cout << q[i];
return 0;
}
}
return 0;
}*/

#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;

int main()
{
int n, m;
cin >> n >> m;

cout << n * m - (n + m);
return 0;
}


ssyyg11
2天前

9个数据 不会了其他的

#include<iostream>
#include<algorithm>
#include<cstring>

using namespace std;
typedef long long LL;
int w, m, n;

int roow(int c, int x)
{
int row;
if(c % 2 == 0 || c == 0)
{
if(x > w)
row = x % w - 1;    //x - (x % w) + 1;
else row = x;
}
else if(c == 1 || c % 2 != 0)
row = (w + 1) - (x % w) - 1;
}

int main()
{
LL res = 0;
cin >> w >> m >> n; //n, m待计算的楼层号, w为排号宽度

//先判断两个点的楼层号
int ml = m / w;
int nl = n / w;

int heigh = abs(ml - nl);  //两点距离的高度, m = 8, n = 2

res = abs(roow(ml, m) - roow(nl, n)) + heigh;
/*cout << "ml=" << ml << endl;
cout << "nl=" << nl << endl;
cout << roow(ml, m) << ' ' << roow(nl, n) << endl;*/
cout << res;
return 0;
}


ssyyg11
3天前
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;

const int N = 110;
char a[N], b[N];

void swap1(int i)
{
if(a[i] == '*')
a[i] = 'o';
else a[i] = '*';
}

int main()
{
int res = 0;

cin >> a >> b;

for(int i = 0; i < strlen(a) - 1; i ++)
if(a[i] != b[i])
{
swap1(i), swap1(i + 1);
res ++;
}

cout << res;
return 0;
}


ssyyg11
3天前
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;

const int N = 100010;
int q[N], p[N];

int main()
{
int n;
cin >> n;
for(int i = 1; i <= n; i ++)
cout << max(i - 1, n - i) * 2 << endl;
return 0;
}


ssyyg11
3天前
#include<iostream>
using namespace std;

typedef long long LL;

int main()
{
LL a, b, n;
cin >> a >> b >> n;
LL sum = 0;
for(int i = 1; i <= 1000; i ++)
{
if(i % 6 == 0 || i % 7 == 0)
sum += b;
else sum += a;

if(sum >= n)
{
cout << i;
return 0;
}
}
return 0;
}


ssyyg11
3天前
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;

typedef long long LL;
const int N = 100010;
LL s[N], cnt[N];

int main()
{
LL n, k;
cin >> n >> k;

for(int i = 1; i <= n; i ++)
{
cin >> s[i];
s[i] += s[i - 1];
}

LL res = 0;
cnt[0] = 1;

for(int i = 1; i <= n; i ++)
{
res += cnt[s[i] % k];
cnt[s[i] % k] ++;
}
cout << res;
return 0;
}