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的更多相关文章

  1. HTTPS强制安全策略-HSTS协议阅读理解

    https://developer.mozilla.org/en-US/docs/Web/Security/HTTP_strict_transport_security [阅读理解式翻译,非严格遵循原 ...

  2. Codeforces#543 div2 A. Technogoblet of Fire(阅读理解)

    题目链接:http://codeforces.com/problemset/problem/1121/A 真·阅读理解 题意就是 有n个人 pi表示他们的强度 si表示他们来自哪个学校 现在Arkad ...

  3. 用Keras搞一个阅读理解机器人

    catalogue . 训练集 . 数据预处理 . 神经网络模型设计(对话集 <-> 问题集) . 神经网络模型设计(问题集 <-> 回答集) . RNN神经网络 . 训练 . ...

  4. Tensorflow做阅读理解与完形填空

    catalogue . 前言 . 使用的数据集 . 数据预处理 . 训练 . 测试模型运行结果: 进行实际完形填空 0. 前言 开始写这篇文章的时候是晚上12点,突然想到几点新的理解,赶紧记下来.我们 ...

  5. P3879 [TJOI2010]阅读理解 题解

    P3879 [TJOI2010]阅读理解 题解 题目描述 英语老师留了N篇阅读理解作业,但是每篇英文短文都有很多生词需要查字典,为了节约时间,现在要做个统计,算一算某些生词都在哪几篇短文中出现过. 输 ...

  6. 阅读关于DuReader:百度大规模的中文机器阅读理解数据集

    很久之前就得到了百度机器阅读理解关于数据集的这篇文章,今天才进行总结!.... 论文地址:https://arxiv.org/abs/1711.05073 自然语言处理是人工智能皇冠上的明珠,而机器阅 ...

  7. Trie树【P3879】 [TJOI2010]阅读理解

    Description 英语老师留了N篇阅读理解作业,但是每篇英文短文都有很多生词需要查字典,为了节约时间,现在要做个统计,算一算某些生词都在哪几篇短文中出现过. Input 第一行为整数N,表示短文 ...

  8. Trie树【洛谷P3879】 [TJOI2010]阅读理解

    P3879 [TJOI2010]阅读理解 题目描述 英语老师留了N篇阅读理解作业,但是每篇英文短文都有很多生词需要查字典,为了节约时间,现在要做个统计,算一算某些生词都在哪几篇短文中出现过. 输入输出 ...

  9. P3879 [TJOI2010]阅读理解

    \(\color{#0066ff}{ 题目描述 }\) 英语老师留了N篇阅读理解作业,但是每篇英文短文都有很多生词需要查字典,为了节约时间,现在要做个统计,算一算某些生词都在哪几篇短文中出现过. \( ...

随机推荐

  1. C++ 无锁数据结构

    https://www.zhihu.com/question/52629893/answer/131731126

  2. android学习十二(android的Content Provider(内容提供器)的使用)

    文件存储和SharePreference存储以及数据存储一般为了安全,最好用于当前应用程序中訪问和存储数据.内容提供器(Content Provider)主要用于在不同的应用程序之间实现数据共享的功能 ...

  3. spring boot 搭建

    http://www.ityouknow.com/springboot/2018/06/12/spring-boo-java-simple.html 在http://start.spring.io/下 ...

  4. ElasticSearch 5.0及head插件安装

    一.elasticsearch安装配置 1.官网下载源码包 https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.0 ...

  5. iOS开发之Found a swap file by the name ".podfile.swp" owned by: Netban dated:...file name: ~N...

    Found a swap file by the name ".podfile.swp" owned by: Netban dated: Fri Mar 24 13:57:27 2 ...

  6. Python之数学题目练习

    首先,下面的题目来自我的大学同学的分享,他用数学证明,我用编程计算机发现了答案. 他的数学推理: 然后下面是我的Python代码: #coding=utf-8 # 井的高度 well_hegith = ...

  7. PEP 492 -- Coroutines with async and await syntax 翻译

    因为工作中慢慢开始用python的协程,所以想更好的理解一下实现方式,故翻译此文 原文中把词汇表放到最后,但是我个人觉得放在最开始比较好,这样可以增加当你看原文时的理解程度 词汇表 原生协程函数 Na ...

  8. SSL SSH

    http://www.91ri.org/13679.html https://www.linux.com/blog/how-install-ssl-certificate-linux-server h ...

  9. 解決中文地址Uri.IsWellFormedUriString返回false

    數字和大小寫字母都ok,但是中文地址就會有問題 public bool IslocalURL(string url) { if (string.IsNullOrEmpty(url)) { return ...

  10. 你真的理解Python中MRO算法吗?[转]

    [前言] MRO(Method Resolution Order):方法解析顺序.Python语言包含了很多优秀的特性,其中多重继承就是其中之一,但是多重继承会引发很多问题,比如二义性,Python中 ...