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. 转【微信小程序 四】二维码生成/扫描二维码

    原文:https://blog.csdn.net/xbw12138/article/details/75213274 前端 二维码生成 二维码要求:每分钟刷新一次,模拟了个鸡肋,添加了个按分钟显示的时 ...

  2. masonry 基本用法

    一:masonry 基本用法 fistView=[[UIView alloc] init]; fistView.backgroundColor=[UIColor redColor]; [self.vi ...

  3. Effective Java 第三版——80. EXECUTORS, TASKS, STREAMS 优于线程

    Tips 书中的源代码地址:https://github.com/jbloch/effective-java-3e-source-code 注意,书中的有些代码里方法是基于Java 9 API中的,所 ...

  4. lsb_release command not found

    Linux里的lsb_release命令用来查看当前系统的发行版信 息(prints certain LSB (Linux Standard Base) and Distribution inform ...

  5. atom汉化

    Atom 是 Github 专门为程序员推出的一个跨平台文本编辑器. 推荐一下 Atom官方网站https://atom.io/ GitHub 以后肯定会通过官方模块把 Atom 和 GitHub 进 ...

  6. 你可能不知道的IDEA高级调试技巧

    一.条件断点 循环中经常用到这个技巧,比如:遍历1个大List的过程中,想让断点停在某个特定值. 参考上图,在断点的位置,右击断点旁边的小红点,会出来一个界面,在Condition这里填入断点条件即可 ...

  7. 【Java】设计模型-五种单例模型

    一. 什么是单例模式 只需要某个类同时保留一个对象,不希望有更多对象,此时,我们则应考虑单例模式的设计. 单例模式的主要作用是保证在Java程序中,某个类只有一个实例存在. 单例模式有很多好处,它能够 ...

  8. 六、编写第一个应用【外部nodejs调用】

    一. 参考地址:https://hyperledger-fabric.readthedocs.io/en/latest/write_first_app.html 根据前几节的配置 1.下载代码 git ...

  9. android studio设置imageview显示图片

    拖动imageview 选择图片 .png 代码引用: private Imageview pay; pay = (ImageView)findViewById(R.id.imageView2); p ...

  10. java递归算法提前返回值带出

    /** * */ package testJava.java.foreach; import java.util.ArrayList; import java.util.LinkedList; imp ...