8.24-河西校区
Leo_Luo_Xiaohei · · 个人记录
8.24-河西校区
::::::info[T1]{open}
T640711 快递费用
::::info[题意] 某邮寄公司按物品重量和目的地区域收费。
重量标准为:
不足
目的地区域标准:
区域
区域
区域
区域
| 区域 |
|---|
| ::::info[思路] |
| 按照题意模拟即可。 |
| :::: |
| ::::success[赛时代码&得分] |
| $$ |
| \color{green}{Accepted\not100tps} |
| $$ |
#include <bits/stdc++.h>
using namespace std;
int x, y, z = 20;
signed main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> x >> y;
if (y == 1)
y = 4;
else if (y == 2)
y = 6;
else if (y == 3)
y = 9;
else if (y == 4)
y = 10;
else
y = 17;
x -= 500;
while (x > 0) {
x -= 500;
z += y;
}
cout << z;
return 0;
}
| :::: |
|---|
::::::info[T2]{open}
T638889 石头布没有剪刀
::::info[题意]
你和对手都只有两种出拳方式:石头 g 和布p,规则一样,赢了得一分,平局不得分,输了减一分。
现给你对手的出拳方式,在对于任意位置
:::: ::::info[思路] 能出布就出布。 :::: ::::success[正解]
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
string s;
int cnt1, cnt2, sc;
signed main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> s;
int n = s.size();
for (int i = 0; i < n; i ++)
if (s[i] == 'g')
if (cnt1 == cnt2)
cnt1 ++;
else {
cnt2 ++;
sc ++;
}
else
if (cnt1 == cnt2) {
cnt1 ++;
sc --;
} else
cnt2 ++;
cout << sc;
return 0;
}
| :::: |
|---|
::::::info[T3]{open}
T644252 篝火问题
::::info[题意] 在一个二维平面上,原点存在一个篝火,会不停地在这一格产生烟雾。每秒都有风把烟雾吹向四方,风速一秒一格。
| 求在观测点 |
|---|
| ::::warning[赛时得分] |
| 根本没写。 |
| $$ |
| \color{red}{Unaccepted\not0tps} |
| $$ |
| :::: |
| ::::info[思路] |
| 由于一个一个模拟烟雾移动太费时间,故利用题目所说“求观测点是否有烟雾”和相对运动,只移动篝火和人。 |
| :::: |
| ::::success[正解] |
| ```cpp line-numbers |
| #include <bits/stdc++.h> |
| using namespace std; |
| const int N = 2e5 + 5; |
| map<pair<int, int>, bool> mp; |
| int n, r, c, x, y, _1, _2; |
| char C; |
| signed main() { |
| ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); |
| cin >> n >> r >> c; |
| mp[{x, y}] = 1; |
| for (int i = 1; i <= n; i ++) { |
| cin >> C; |
| if (C == 'N') { |
| x ++; |
| r ++; |
| } else if (C == 'S') { |
| x --; |
| r --; |
| } else if (C == 'W') { |
| y ++; |
| c ++; |
| } else if (C == 'E') { |
| y --; |
| c --; |
| } |
| mp[{x, y}] = 1; |
| if (mp.count({r, c})) |
| cout << 1; |
| else |
| cout << 0; |
| } |
| return 0; |
| } |
| ``` |
| :::: |
| :::::: |
::::::info[T4]{open}
T639146 落落的去的数学问题3
::::info[题意]
定义
将
给定一个长度为
:::: ::::warning[赛时得分] 暴力。
::::
::::info[思路]
对于每一个
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 5, mod = 998244353;
ll n, ans;
ll a[N], b[N];
int f(int x, int y) {
string a = i2s(x), b = i2s(y);
ll res = s2l(a + b);
res %= mod;
return res;
}
ll gtl(ll x) {
ll cnt = 0;
for (; x; cnt ++)
x /= 10;
return cnt;
}
ll p(ll x) {
ll res = 1;
for (ll i = 1; i <= x; i ++)
res = (res * 10);
return res % mod;
}
signed main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> n;
for (int i = 1; i <= n; i ++) {
cin >> a[i];
b[i] = (b[i - 1] + a[i]) % mod;
}
for (int j = 2; j <= n; j ++) {
ll len = gtl(a[j]);
ans += (b[j - 1] * p(len)) % mod + ((j - 1) * (a[j] % mod)) % mod;
ans %= mod;
}
cout << ans;
return 0;
}
| :::: |
|---|
::::::info[T5]{open}
P1100 高低位交换
::::info[题意]
给出一个小于 unsigned 类型,取其前十六位和后十六位,相加即可。
::::
::::success[赛时得分&代码]
#include <bits/stdc++.h>
#define u unsigned
using namespace std;
const int N = 2e5 + 5;
u x, y, z;
signed main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> x;
y = x >> 16;
z = x << 16;
cout << y + z;
return 0;
}
| :::: |
|---|