【模拟与阅读理解】Gym - 101954C Rullete
http://codeforces.com/gym/101954/problem/C
题意:14行伪代码让你翻译。
坑得yibi
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<math.h>
#include<ctime>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
const int MAXN = 1e5 + ;
const int maxn = MAXN;
const long long MOD = 1e9 + ;
#define rep(i,t,n) for(int i =(t);i<=(n);++i)
#define per(i,n,t) for(int i =(n);i>=(t);--i)
#define mmm(a,b) memset(a,b,sizeof(a))
//#define x first
//#define y second void smain();
#define ONLINE_JUDGE
int main() { ios::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
FILE *myfile;
myfile = freopen("C:\\Users\\acm-14\\Desktop\\test\\b.in", "r", stdin);
if (myfile == NULL)
fprintf(stdout, "error on input freopen\n");
FILE *outfile;
outfile = freopen("C:\\Users\\acm-14\\Desktop\\test\\out.txt", "w", stdout);
if (outfile == NULL)
fprintf(stdout, "error on output freopen\n");
long _begin_time = clock();
#endif
smain();
#ifndef ONLINE_JUDGE
long _end_time = clock();
printf("time = %ld ms.", _end_time - _begin_time);
#endif
return ;
} string cards[];
int cval[];
char ctyp[];
string crk[];
int typ[];
/*2D 5D JD KC AC*/
int score = ;
int cntmod = ;
void fff(int x) {
if (x == ) {
score++;
int tmp = ;
rep(i, , )if (crk[i] == "J")tmp++;
score += tmp * cval[];
}
if (x == ) {
//int last = score;
rep(i, , ) {
typ[ctyp[i]]++;
}
rep(i, , )if (typ[i] >= ) { score *= ; break; }
//if (last != score)cntmod++, lastmod = 2;
}
if (x == ) { //last = score;
if (typ['C'] > && typ['S'] > && typ['H'] > && typ['D'] > )score *= ;
//if (last != score)cntmod++, lastmod = 3;
}
if (x == ) {
//last = score;
score += abs(typ['C'] + typ['S'] - typ['H'] - typ['D']);
// if (last != score)cntmod++, lastmod = 4;
}
if (x == ) {
//last = score;
if (score % == ) {
int t = ;
rep(i, , score) {
if (score%i == )t += i;
}
score += t;
}
//if (last != score)cntmod++, lastmod = 5;
}//
if (x == ) {
//last = score;
int cnt7 = ;
rep(i, , )if (cval[i] == )cnt7++;
if (cnt7 == )score -= * ;
//if (last != score)cntmod++, lastmod = 6;
}
//
if (x == ) {
//last = score;
if (score >= ) {
int mn = ;
rep(i, , )mn = min(mn, cval[i]);
score += mn;
}
//if (last != score)cntmod++, lastmod = 7;
}//
if (x == ) {
//last = score;
if (score < )score *= -;
//if (last != score)cntmod++, lastmod = 8;
}//
if (x == ) {
//last = score;
if (typ['D'] >= ) {
score += ;
rep(i, , ) {
if (cval[i] == )cval[i] = , crk[i] = '';
else if (cval[i] == )cval[i] = , crk[i] = '';
else if (cval[i] == )cval[i] = , crk[i] = '';
else if (cval[i] == )cval[i] = , crk[i] = '';
}
}
//if (last != score)cntmod++, lastmod = 9;
}//
if (x == ) {
//last = score;
int a[];
int cnta = ;
rep(i, , ) {
if (crk[i] >= ""&&crk[i] <= "")a[i] = crk[i][] - '';
if (crk[i].length() == )a[i] = ;
if (crk[i] == "A")a[i] = , cnta++;;
if (crk[i] == "J")a[i] = ;
if (crk[i] == "Q")a[i] = ;
if (crk[i] == "K")a[i] = ;
}
sort(a + , a + + );
int f = ;
rep(i, , )if (a[i] != a[i + ] - )f = ; if ( f)score += cnta * ;
//if (last != score)cntmod++, lastmod = 10;
}//
if (x == ) {
//last = score;
if (cntmod > ) {
int x = score;
while (x) {
score += x & ;
x >>= ;
}
//score += __builtin_popcount(8);
}
//if (last != score)cntmod++, lastmod = 11;
}
}
void smain()
{
rep(i, , ) {
cin >> cards[i];
if (cards[i][] >= ''&&cards[i][] <= '')cval[i] = cards[i][] - '';
else cval[i] = ;
if (cards[i].length() == )cval[i] = , ctyp[i] = cards[i][],crk[i]="";
else ctyp[i] = cards[i][],crk[i]=cards[i][]; } rep(i, , )score += cval[i]; int lastmod = ;
//
score++; cntmod++;
int tmp = ;
rep(i, , )if (crk[i] == "J")tmp++;
score += tmp * cval[];
//
int last = score;
rep(i, , ) {
typ[ctyp[i]]++;
}
rep(i, , )if (typ[i] >= ) { score *= ; break; }
if (last != score)cntmod++, lastmod = ;
//
last = score;
if (typ['C'] > && typ['S'] > && typ['H'] > && typ['D'] > )score *= ;
if (last != score)cntmod++, lastmod = ;
//
last = score;
score += abs(typ['C'] + typ['S'] - typ['H'] - typ['D']);
if (last != score)cntmod++,lastmod = ;
//
last = score;
if (score % == ) {
int t = ;
rep(i, , score) {
if (score%i == )t += i;
}
score += t;
}
if (last != score)cntmod++, lastmod = ;
//
last = score;
int cnt7 = ;
rep(i, , )if (cval[i] == )cnt7++;
if (cnt7 == )score -= * ;
if (last != score)cntmod++, lastmod = ;
//
last = score;
if (score >= ) {
int mn = ;
rep(i, , )mn = min(mn, cval[i]);
score += mn;
}
if (last != score)cntmod++, lastmod = ;
//
last = score;
if (score < )score *= -;
if (last != score)cntmod++, lastmod = ;
//
last = score;
if (typ['D'] >= ) {
score += ;
rep(i, , ) {
if (cval[i] == )cval[i] = , crk[i] = "";
else if (cval[i] == )cval[i] = , crk[i] = "";
else if (cval[i] == )cval[i] = , crk[i] = "";
else if (cval[i] == )cval[i] = , crk[i] = "";
}
}
if (last != score)cntmod++, lastmod = ;
//
last = score;
int a[];
int cnta=;
rep(i, , ) {
if (crk[i] >= ""&&crk[i] <= "")a[i] = crk[i][] - '';
if (crk[i].length() == )a[i] = ;
if (crk[i] == "A")a[i] = , cnta++;;
if (crk[i] == "J")a[i] = ;
if (crk[i] == "Q")a[i] = ;
if (crk[i] == "K")a[i] = ;
}
sort(a + , a + + );
int f = ;
rep(i, , )if (a[i] != a[i + ] - )f = ; if (f)score += cnta * ;
if (last != score)cntmod++, lastmod = ;
//
last = score;
if (cntmod > ) {
int x = score;
while (x) {
score += x & ;
x >>= ;
}
//score += __builtin_popcount(8);
}
if (last != score)cntmod++, lastmod = ;
//
rep(i, , ) {
if (cval[i] == ) {
fff(lastmod);
break;
}
}
//
rep(i, , ) {
if (cval[i] == ) {
if(score>=) { score *= ; break; } }
}
cout << score << endl; //int n;
//cin >> n;
}
/*,
o:o
:o:
o:o
33333333333
QC 8D JD 10S 9D
2D 5D JD KC AC
*/
【模拟与阅读理解】Gym - 101954C Rullete的更多相关文章
- HTTPS强制安全策略-HSTS协议阅读理解
https://developer.mozilla.org/en-US/docs/Web/Security/HTTP_strict_transport_security [阅读理解式翻译,非严格遵循原 ...
- Codeforces#543 div2 A. Technogoblet of Fire(阅读理解)
题目链接:http://codeforces.com/problemset/problem/1121/A 真·阅读理解 题意就是 有n个人 pi表示他们的强度 si表示他们来自哪个学校 现在Arkad ...
- 用Keras搞一个阅读理解机器人
catalogue . 训练集 . 数据预处理 . 神经网络模型设计(对话集 <-> 问题集) . 神经网络模型设计(问题集 <-> 回答集) . RNN神经网络 . 训练 . ...
- Tensorflow做阅读理解与完形填空
catalogue . 前言 . 使用的数据集 . 数据预处理 . 训练 . 测试模型运行结果: 进行实际完形填空 0. 前言 开始写这篇文章的时候是晚上12点,突然想到几点新的理解,赶紧记下来.我们 ...
- P3879 [TJOI2010]阅读理解 题解
P3879 [TJOI2010]阅读理解 题解 题目描述 英语老师留了N篇阅读理解作业,但是每篇英文短文都有很多生词需要查字典,为了节约时间,现在要做个统计,算一算某些生词都在哪几篇短文中出现过. 输 ...
- 阅读关于DuReader:百度大规模的中文机器阅读理解数据集
很久之前就得到了百度机器阅读理解关于数据集的这篇文章,今天才进行总结!.... 论文地址:https://arxiv.org/abs/1711.05073 自然语言处理是人工智能皇冠上的明珠,而机器阅 ...
- Trie树【P3879】 [TJOI2010]阅读理解
Description 英语老师留了N篇阅读理解作业,但是每篇英文短文都有很多生词需要查字典,为了节约时间,现在要做个统计,算一算某些生词都在哪几篇短文中出现过. Input 第一行为整数N,表示短文 ...
- Trie树【洛谷P3879】 [TJOI2010]阅读理解
P3879 [TJOI2010]阅读理解 题目描述 英语老师留了N篇阅读理解作业,但是每篇英文短文都有很多生词需要查字典,为了节约时间,现在要做个统计,算一算某些生词都在哪几篇短文中出现过. 输入输出 ...
- P3879 [TJOI2010]阅读理解
\(\color{#0066ff}{ 题目描述 }\) 英语老师留了N篇阅读理解作业,但是每篇英文短文都有很多生词需要查字典,为了节约时间,现在要做个统计,算一算某些生词都在哪几篇短文中出现过. \( ...
随机推荐
- bootstrap响应式前端页面
技术:HTML+CSS+JS+bootstrap 概述 这套代码响应式前端页面基本写完了,适合初学前端的同学,里面主要运用了HTML+CSS布局和动画,js逻辑较少,页面都是静态,未接入接口.响应 ...
- Android报“android.content.res.Resources$NotFoundException: String resource ID #0x2”错误
Android报“android.content.res.Resources$NotFoundException: String resource ID #0x2”错误 当调用setText()方法时 ...
- ubuntu intel网卡驱动安装(华硕B250F GAMING主板 )
jikexianfeng@jikexianfeng:~$ sudo sudo lspci -knn :]: Intel Corporation Device [:591f] (rev ) Subsys ...
- 理解Java注解类型
一. 理解Java注解 注解本质是一个继承了Annotation的特殊接口,其具体实现类是Java运行时生成的动态代理类.而我们通过反射获取注解时,返回的是Java运行时生成的动态代理对象$Proxy ...
- 【C#】解析C#中管道流的使用
目录结构: contents structure [+] 匿名管道(anonymous pipe) 命名管道(named pipe) 管道为进程间通信提供了一种可能.管道分为两种,一种是匿名管道,另一 ...
- OpenLayers4地图实例-功能齐全
网址:http://api.rivermap.cn/openlayers4/map.min.html 标注 工具
- DMA(直接存储器存取)
DMA(Direct Memory Access) DMA(Direct Memory Access)即直接存储器存取,是一种快速传送数据的机制. 工作原理 DMA是指外部设备不通过CPU而直接与系统 ...
- 物联网架构成长之路(29)-Jenkins环境搭建
0. 说明 哈哈,前面中间插入了一篇Eclipse增加Git插件,在此之前真的没有用过GIT. 1. 运行Jenkins 这里为了方便,还是用Docker方式安装,由于这个是标准的war报,不对Doc ...
- [转]application.properties详解 --springBoot配置文件
本文转载:http://blog.csdn.net/lpfsuperman/article/details/78287265###; # spring boot application.propert ...
- HTTP缓存及其合理使用
以前以为HTTP缓存是个简单的事,项目中遇到后才发觉关于缓存实践有挺深的学问. from几篇文章详见: 使用 HTTP 缓存:Etag, Last-Modified 与 Cache-Control 合 ...