The 15th Jilin Provincial Collegiate Programming Contest
The 15th Jilin Provincial Collegiate Programming Contest
A. Random Number Checker
签到
#include <bits/stdc++.h>
using namespace std;
int main() {int n;cin >> n;int odd = 0, even = 0;for (int i = 1; i <= n; i ++ ) {int a;cin >> a;if (a & 1) odd ++ ;else even ++;}if (abs(even - odd) <= 1) cout << "Good" << endl;else cout << "Not Good" << endl;return 0;
}
B. Arithmetic Exercise
签到,模拟除法
#include <bits/stdc++.h>
using namespace std;
int main() {int a, b, k;cin >> a >> b >> k;if (a == b) {cout << 1 << '.';for (int i = 1; i <= k; i ++ )cout << 0 << endl;} else {cout << 0 << '.';int cnt = 1;while (cnt != k) {if (a < b) a *= 10;cout << a / b;a %= b;cnt ++;}if (a < b) a *= 10;int ans = a / b;a %= b;if (a < b) a *= 10;int tmp = a / b;if (tmp >= 5 && tmp <= 9) ans ++;cout << ans << endl;}
}
C. Random Number Generator
E. Great Detective TJC
签到
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a[N];
int main() {int t;scanf("%d", &t);while (t -- ) {int n;scanf("%d", &n);for (int i = 1; i <= n; i ++ ) scanf("%d", a + i);sort(a + 1, a + n + 1);bool ok = 0;for (int i = 1; i < n; i ++ ) {if (a[i] + 1 == a[i + 1]) {if ((a[i] ^ a[i + 1]) == 1) {ok = 1;break;}}}if (ok) cout << "Yes" << endl;else cout << "No" << endl;}return 0;
}
G. Matrix Repair
思路
H. Visit the Park
思路
#include <bits/stdc++.h>
using namespace std;
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
typedef pair<int, int> PII;
typedef vector<int> VI;
const int mod = 998244853;
const int N = 3e5 + 10;
map<PII, VI> mp;
map<PII, PII> edg;
int a[N];
LL qi(LL a) {LL ans = 1;int p = mod - 2;while (p ) {if (p & 1) ans = ans * a % mod;a = a * a % mod;p >>= 1;}return ans;
}
int main() {int n, m, k;scanf("%d%d%d", &n, &m, &k);for (int i = 1; i <= m; i ++ ) {int u, v, w;scanf("%d%d%d", &u, &v, &w);if (u < v) mp[MP(u, v)].PB(w);else mp[MP(v, u)].PB(w);}LL ans = 0;LL pos = 1;LL t = qi(10);bool ok = 1;for (int i = 1; i < k - 1; i ++ ) pos = pos * 10 % mod;for (int i = 1; i <= k; i ++ ) scanf("%d", a + i);for (int i = 1; i < k; i ++ ) {int u = min(a[i], a[i + 1]), v = max(a[i], a[i + 1]);VI tmp = mp[MP(u, v)];int len = tmp.size();if (len == 0) {ok = 0;break;}LL key = qi(len);for (int j = 0; j < len; j ++ ) {ans = (ans + ((pos * tmp[j]) % mod * key) % mod) % mod;}pos = pos * t % mod;}if (ok) cout << ans << endl;else cout << "Stupid Msacywy!" << endl;return 0;
}
K. Bracket Sequence
思路
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;
LL base[N], inv[N];
LL qi(LL a) {LL ans = 1;int p = mod - 2;while (p) {if (p & 1) ans = ans * a % mod;a = a * a % mod;p >>= 1;}return ans;
}
int main() {int n, k;cin >> n >> k;LL b = 1;for (int i = 1; i <= n; i ++ ) b = b * k % mod;base[0] = 1;for (int i = 1; i <= 2 * n; i ++ ) {base[i] = base[i - 1] * i % mod;if (i == n) inv[i] = qi(base[i]);}LL x = qi(n + 1);cout << (((base[2 * n] * inv[n] % mod) * inv[n] % mod) * x % mod)* b % mod << endl;return 0;
}
L. Suzuran Loves String
思路
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
char str[N];
int main(){int t;scanf("%d", &t);while (t -- ) {int ans = 0;scanf("%s", str);int len = strlen(str);bool ok = 1;for (int i = 1; i < len; i ++ ) if (str[i] != str[i - 1]) {ok = 0;break;}if (ok) {cout << len - 1 << endl;continue;}int pos;for (pos = 1; pos < len; pos ++ ) {if (str[pos] != str[0]) {break;}}cout << 2 * len - pos << endl;}return 0;
}
M. Sequence
签到
#include <bits/stdc++.h>
using namespace std;
int main() {int n;cin >> n;int mx = -1e9, mn = 1e9;for (int i = 1; i <= n; i ++ ) {int a;cin >> a;mn = min(mn, a), mx = max(mx, a);}cout << 1ll * n * (mx - mn) << endl;return 0;
}
The 15th Jilin Provincial Collegiate Programming Contest相关推荐
- 第十五届吉林省赛The 15th Jilin Provincial Collegiate Programming Contest C.Random Number Generator(数学 BSGS)
文章目录 题意 题解 代码 总结 题目链接 题意 : 题解 : BSGS 代码 : #include <bits/stdc++.h> #include <unordered_map& ...
- The 15th Heilongjiang Provincial Collegiate Programming Contest题解 gym102803
The 15th Heilongjiang Provincial Collegiate Programming Contest题解 gym102803 前言 题目 A. August B. Bills ...
- 「团队训练赛」The 14th Jilin Provincial Collegiate Programming Contest「ABCEFGJLM」
The 14th Jilin Provincial Collegiate Programming Contest A. Chord 题目描述: 给出C, C#, D, D#, E, F, F#, G, ...
- The 15th Heilongjiang Provincial Collegiate Programming Contest (A、G、H、L)
The 15th Heilongjiang Provincial Collegiate Programming Contest A. August G. Goodbye H. Hate That Yo ...
- 【ZJCPC2018 第15届 浙江省赛】The 15th Zhejiang Provincial Collegiate Programming Contest(MABLJK 6题)
补题地址:https://zoj.pintia.cn/home/news 搜索15th 本文按照通过率补的题 M. Lucky 7 题意:如果存在从给出的长为n的序列中选择一个数+b 可以被7整除,就 ...
- The 15th Heilongjiang Provincial Collegiate Programming Contest(A,C,F,G,H,L)
比赛链接 2021/2/7训练赛 Problem.A August 题解 不难发现上半部分是个半径为 a a a的圆,下半部分利用割补小正方形的方法得出等价于一个长为 2 a 2a 2a,宽为 2 b ...
- The 16th Heilongjiang Provincial Collegiate Programming Contest部分题解
The 16th Heilongjiang Provincial Collegiate Programming Contest 目录 D - Doin' Time 题目思路 题目代码 F - Func ...
- The 15th Chinese Northeast Collegiate Programming Contest部分题解
The 15th Chinese Northeast Collegiate Programming Contest 目录 E. Easy Math Problem 题目思路 题目代码 I. Takea ...
- 2019 浙江省赛部分题解(The 16th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple)
签到题 GLucky 7 in the Pocket Time Limit: 1 Second Memory Limit: 65536 KB BaoBao loves number 7 bu ...
最新文章
- MLIR: Infrastructure架构
- tomcat中request对象是被创建的_常用开源框架中设计模式使用分析(全)
- DL之LSTM:基于tensorflow框架利用LSTM算法对气温数据集训练并回归预测
- [云炬创业基础笔记]第七章创业资源测试7
- Struts2.3.5+Hibernate3+Spring3.1基于注解实现的多文件上传,下载
- 使用RandomAccessFile读写数据
- 如何使用光学检测汽车前仪表盘玻璃
- 模糊PID控制器设计
- 模拟调节器和数字计算机如何实现PID控制,模拟PID-调节器设计及数字化实现.doc...
- 基于Java的企业内部通信系统的设计与实现
- svn使用(服务器端和客户端)
- 等价类划分和边界值法
- 【2019斯坦福CS224N笔记】(5)The probability of a sentence Recurrent Neural Networks and Language Models
- 实践数据湖iceberg 第九课 合并小文件
- ruby如何开发接入短信发送预约挂号、医嘱、体检报告等短信demo示例
- Unity制作RPG游戏——按键功能的分类与实现
- 通过DS18B20学时序
- video怎么自动播放
- 人人商城手机端添加控制器
- 庆祝我的新浪博客升级到第十级
热门文章
- 安全运营四要素之资产、脆弱性、威胁和事件
- android培训机构排名
- android 编译 release版本,详细android gradle 只编译realse版本
- 在linux安装java过程_挑战Java在Linux上安装过程分享
- linux下磁盘sda,Linux下磁盘设备文件(sda,sdb,sdc….)变化的问题
- Python_美多商城(用户中心)_5
- java跨境电商ERP系统源码 亚马逊跨境电商全套源码SaaS系统
- UMLChina建模竞赛第3赛季第2轮
- 数字化变电站与智能化变电站的关系
- Vue子组件重新渲染