来自HDOJ:

5833 ( Zhu and 772002 )

 /*
━━━━━┒ギリギリ♂ eye!
┓┏┓┏┓┃キリキリ♂ mind!
┛┗┛┗┛┃\○/
┓┏┓┏┓┃ /
┛┗┛┗┛┃ノ)
┓┏┓┏┓┃
┛┗┛┗┛┃
┓┏┓┏┓┃
┛┗┛┗┛┃
┓┏┓┏┓┃
┛┗┛┗┛┃
┓┏┓┏┓┃
┃┃┃┃┃┃
┻┻┻┻┻┻
*/
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <climits>
#include <complex>
#include <cassert>
#include <cstdio>
#include <bitset>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <ctime>
#include <set>
#include <map>
#include <cmath>
using namespace std;
#define fr first
#define sc second
#define cl clear
#define BUG puts("here!!!")
#define W(a) while(a--)
#define pb(a) push_back(a)
#define Rint(a) scanf("%d", &a)
#define Rll(a) scanf("%I64d", &a)
#define Rs(a) scanf("%s", a)
#define Cin(a) cin >> a
#define FRead() freopen("in", "r", stdin)
#define FWrite() freopen("out", "w", stdout)
#define Rep(i, len) for(int i = 0; i < (len); i++)
#define For(i, a, len) for(int i = (a); i < (len); i++)
#define Cls(a) memset((a), 0, sizeof(a))
#define Clr(a, x) memset((a), (x), sizeof(a))
#define Full(a) memset((a), 0x7f7f7f, sizeof(a))
#define lrt rt << 1
#define rrt rt << 1 | 1
#define pi 3.14159265359
#define RT return
#define lowbit(x) x & (-x)
#define onenum(x) __builtin_popcount(x)
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
typedef pair<LL, LL> pll;
typedef map<string, int> msi;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef vector<vl> vvl;
typedef vector<bool> vb; const int maxn = ;
const int maxm = ;
const LL mod = ;
typedef struct Bucket {
LL b[maxm];
}Bucket;
int n;
LL a[maxn];
bool _p[maxm];
LL prime[maxm];
int pcnt;
LL dp[maxn][maxn]; void init() {
Cls(_p); pcnt = ;
For(i, , maxm) {
if(_p[i] == ) {
prime[pcnt++] = i;
for(int j = i * ; j < maxm; j+=i) {
_p[j] = ;
}
}
}
} void gao(int i, LL x) {
for(int j = ; j < pcnt; j++) {
if(x % prime[j]) continue;
int cnt = ;
while(x % prime[j] == ) {
x /= prime[j];
cnt ^= ;
}
dp[i][j] = cnt;
}
} LL quickmul(LL x, LL n, LL mod) {
LL ret = ;
while(n) {
if(n & ) ret = (ret * x) % mod;
x = (x * x) % mod;
n >>= ;
}
return ret;
} int main() {
// FRead();
int T, _ = ;
Rint(T);
init();
W(T) {
Cls(dp);
printf("Case #%d:\n", _++);
Rint(n);
For(i, , n+) {
cin >> a[i];
gao(i, a[i]);
}
int p = ;
Rep(i, pcnt) {
For(j, p, pcnt) {
if(dp[j][i]) {
For(k, i, pcnt) {
swap(dp[j][k], dp[p][k]);
}
break;
}
}
if(!dp[p][i]) continue;
For(j, p+, pcnt) {
if(dp[j][i]) {
For(k, i, pcnt) {
dp[j][k] ^= dp[p][k];
}
}
}
p++;
}
cout << (quickmul(,n-p,mod)-+mod)%mod << endl;
}
RT ;
}

5835 ( Danganronpa ) 

 #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cassert>
using namespace std;
int s[];
int main(){
int T,n;
int sum,ans,coco;
scanf("%d",&T);
int pp = ;
while(T--){
int maxn = ;
sum = ;
scanf("%d",&n);
for(int i=;i<n;i++){
scanf("%d",&s[i]);
sum +=s[i];
maxn = maxn < s[i] ? s[i] : maxn;
}
ans = sum/;
if(maxn > sum/){
coco = (sum - maxn) * + ;
ans = coco > ans ? ans : coco;
}
printf("Case #%d: %d\n",pp++,ans);
}
}

5832 ( A water problem ) 

 /*
━━━━━┒ギリギリ♂ eye!
┓┏┓┏┓┃キリキリ♂ mind!
┛┗┛┗┛┃\○/
┓┏┓┏┓┃ /
┛┗┛┗┛┃ノ)
┓┏┓┏┓┃
┛┗┛┗┛┃
┓┏┓┏┓┃
┛┗┛┗┛┃
┓┏┓┏┓┃
┛┗┛┗┛┃
┓┏┓┏┓┃
┃┃┃┃┃┃
┻┻┻┻┻┻
*/
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <climits>
#include <complex>
#include <cassert>
#include <cstdio>
#include <bitset>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <ctime>
#include <set>
#include <map>
#include <cmath>
using namespace std;
#define fr first
#define sc second
#define cl clear
#define BUG puts("here!!!")
#define W(a) while(a--)
#define pb(a) push_back(a)
#define Rint(a) scanf("%d", &a)
#define Rll(a) scanf("%I64d", &a)
#define Rs(a) scanf("%s", a)
#define Cin(a) cin >> a
#define FRead() freopen("in", "r", stdin)
#define FWrite() freopen("out", "w", stdout)
#define Rep(i, len) for(int i = 0; i < (len); i++)
#define For(i, a, len) for(int i = (a); i < (len); i++)
#define Cls(a) memset((a), 0, sizeof(a))
#define Clr(a, x) memset((a), (x), sizeof(a))
#define Full(a) memset((a), 0x7f7f7f, sizeof(a))
#define lrt rt << 1
#define rrt rt << 1 | 1
#define pi 3.14159265359
#define RT return
#define lowbit(x) x & (-x)
#define onenum(x) __builtin_popcount(x)
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
typedef pair<LL, LL> pll;
typedef map<string, int> msi;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef vector<vl> vvl;
typedef vector<bool> vb; const int maxn = ;
char str[maxn];
int len;
int mod(int num) {
int ret = ;
Rep(i, len) {
ret = (int)(((LL)ret * + (str[i] - '')) % num);
}
return ret;
} int main() {
// FRead();
int _ = ;
while(Rs(str)!=EOF) {
printf("Case #%d: ", _++);
len = strlen(str);
int num = ;
if(len <= ) {
Rep(i, len) {
num *= ;
num += str[i] - '';
}
if(num == || num % == ) {
puts("YES");
continue;
}
if(num != || num % != ) {
puts("NO");
continue;
}
}
int t = mod();
if(t == ) puts("YES");
else puts("NO");
}
RT ;
}

5842 ( Lweb and String )

 /*
━━━━━┒ギリギリ♂ eye!
┓┏┓┏┓┃キリキリ♂ mind!
┛┗┛┗┛┃\○/
┓┏┓┏┓┃ /
┛┗┛┗┛┃ノ)
┓┏┓┏┓┃
┛┗┛┗┛┃
┓┏┓┏┓┃
┛┗┛┗┛┃
┓┏┓┏┓┃
┛┗┛┗┛┃
┓┏┓┏┓┃
┃┃┃┃┃┃
┻┻┻┻┻┻
*/
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <climits>
#include <complex>
#include <cassert>
#include <cstdio>
#include <bitset>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <ctime>
#include <set>
#include <map>
#include <cmath>
using namespace std;
#define fr first
#define sc second
#define cl clear
#define BUG puts("here!!!")
#define W(a) while(a--)
#define pb(a) push_back(a)
#define Rint(a) scanf("%d", &a)
#define Rll(a) scanf("%I64d", &a)
#define Rs(a) scanf("%s", a)
#define Cin(a) cin >> a
#define FRead() freopen("in", "r", stdin)
#define FWrite() freopen("out", "w", stdout)
#define Rep(i, len) for(int i = 0; i < (len); i++)
#define For(i, a, len) for(int i = (a); i < (len); i++)
#define Cls(a) memset((a), 0, sizeof(a))
#define Clr(a, x) memset((a), (x), sizeof(a))
#define Full(a) memset((a), 0x7f7f7f, sizeof(a))
#define lrt rt << 1
#define rrt rt << 1 | 1
#define pi 3.14159265359
#define RT return
#define lowbit(x) x & (-x)
#define onenum(x) __builtin_popcount(x)
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
typedef pair<LL, LL> pll;
typedef map<string, int> msi;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef vector<vl> vvl;
typedef vector<bool> vb; const int maxn = ;
char str[maxn];
int ascii[];
int a[maxn];
int n, q;
int ord;
int dp[maxn];
int s[maxn]; int bs(int ll, int rr, int v) {
while(ll <= rr) {
int mm = (ll + rr) >> ;
if(s[mm] < v) ll = mm + ;
else rr = mm - ;
}
return ll;
} int main() {
// FRead();
int T, _ = ;
Rint(T);
W(T) {
ord = ; q = ;
Rs(str);
memset(ascii, -, sizeof(ascii));
memset(dp, , sizeof(dp));
memset(s, 0x7f7f7f7f, sizeof(s));
printf("Case #%d: ", _++);
n = strlen(str);
Rep(i, n) {
if(ascii[str[i]] == -) {
ascii[str[i]] = ord;
a[q++] = ord++;
}
else {
a[q++] = ascii[str[i]];
}
}
int ans = ;
For(i, , n+) {
dp[i] = bs(, i, a[i]);
s[dp[i]] = min(s[dp[i]], a[i]);
ans = max(ans, dp[i]);
}
printf("%d\n", ans);
}
RT ;
}

[CCPC2016]网赛部分比赛代码的更多相关文章

  1. 使用pwn_deploy_chroot部署国赛pwn比赛题目

    目录 使用pwn_deploy_chroot部署国赛pwn比赛题目 一.前言 二.Docker 三.部署镜像 四.pwn_deploy_chroot 五.check && exp 六. ...

  2. 团体程序设计天梯赛(CCCC) L3019 代码排版 方法与编译原理密切相关,只有一个测试点段错误

    团体程序设计天梯赛代码.体现代码技巧,比赛技巧.  https://github.com/congmingyige/cccc_code

  3. 阿里天池 NLP 入门赛 TextCNN 方案代码详细注释和流程讲解

    thumbnail: https://image.zhangxiann.com/jung-ho-park-HbnqEhMBpPM-unsplash.jpg toc: true date: 2020/8 ...

  4. hihoCoder1388 Periodic Signal(2016北京网赛F:NTT)

    题目 Source http://hihocoder.com/problemset/problem/1388 Description Profess X is an expert in signal ...

  5. [JS]东方财富网财经数据汇总代码示例

    把握全球金融状况 一个页面看全球金融,感觉不错 再加上以前做的,读取显示 新浪7*24财经直播数据页面 那看得就更舒服了 下面是 新浪7*24财经直播数据 代码地址: http://www.cnblo ...

  6. hdu4740【杭州网赛、模拟、有点搜索?】

    当时看了这题就感觉so easy...  本来不想写的,后来感觉是不是可以练一下搜索水平.. 比赛时有人过了就没写.       比赛完了写一下. 实现还不是那么顺利,  囧 本来自己以为这题能练下搜 ...

  7. 2018宁夏邀请赛网赛 I. Reversion Count(java练习题)

    题目链接 :https://nanti.jisuanke.com/t/26217 Description: There is a positive integer X, X's reversion c ...

  8. 2013杭州网赛 1001 hdu 4738 Caocao's Bridges(双连通分量割边/桥)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4738 题意:有n座岛和m条桥,每条桥上有w个兵守着,现在要派不少于守桥的士兵数的人去炸桥,只能炸一条桥 ...

  9. HDU 4746 HDOJ Mophues 2013杭州网赛I题

    比赛的时候就预感到这题能出,但是会耗时比较多.结果最后是出了,但是有更简单的题没出. 是不是错误的决策呢?谁知道呢 题目意思: 定义f(x) = x分解质因数出来的因子个数 如 x = p0 * p0 ...

随机推荐

  1. 获取任意可序列化对象的Xml字符串,方便在日志中查看任一所感兴趣的对象。

    代码: public static string GetLoggingString(this object obj) { using (var stream = new MemoryStream()) ...

  2. JavaScript在IE6,IE7下报错'expected identifier, string or number'

    问题: 代码在Forefox和IE8下工作正常,但是在IE6下报错: expected identifier, string or number 假如变量options有多个选项,那么我们可以用逗号分 ...

  3. httpClient多线程请求

    使用httpClient可模拟请求Url获取资源,使用单线程的请求速度上会有一定的限制,参考了Apache给出的例子,自己做了测试实现多线程并发请求,以下代码需要HttpClient 4.2的包,可以 ...

  4. 使用 Swagger UI 与 Swashbuckle 创建 RESTful Web API 帮助文件

    作者:Sreekanth Mothukuru 2016年2月18日 本文旨在介绍如何使用常用的 Swagger 和 Swashbuckle 框架创建描述 Restful API 的交互界面,并为 AP ...

  5. 【译】使用 Python 编写虚拟机解释器

    [译]如何使用 Python 创建一个虚拟机解释器? 原文地址:Making a simple VM interpreter in Python 更新:根据大家的评论我对代码做了轻微的改动.感谢 ro ...

  6. 【剑指offer】和为S的连续整数序列

    找到所有和为S的连续整数序列,序列长度>=2 我的思路:数学法,限定首元素范围,计算序列长度. 书上解法:用small和big两个游标记录序列的开始和结束位置,调整游标. 我的解法: /* ​直 ...

  7. SQL技术内幕-13 SQL优化方法论之分析实例级别的等待

    优化方法论的第一步是在实例级别上找出什么类型的等待占用了大部分的等待时间,这可以通过查询动态管理图(DMV,dynamic management view)sys.dm_os_wait_stats 运 ...

  8. PHP开发入行真功夫 三扬科技

    前言与目录 PHP开发入行真功夫 前言 PHP开发入行真功夫 目录   第2章 基本语法 2.1.1 判断闰年程序 2.1.2 我们现在能做的…… 2.2.1 PHP的语言概貌 2.2.2 为我们的程 ...

  9. C# JSON字符串序列化与反序列化

    JSON与c#对象转换http://hi.baidu.com/donick/item/4d741338870c91fe97f88d33 C# JSON字符串序列化与反序列化 – http://www. ...

  10. Linux网络编程7——使用TCP实现双方聊天

    思路 主线程负责发送消息,另一线程负责接收消息.服务端和客户端均是如此. 注意 当A方close掉用于通信的socket端口后,该端口是不会立即关闭的.因为此时可能B方的信息还没send完.因此,此时 ...