http://acm.hdu.edu.cn/contests/contest_show.php?cid=867

A题,直接分块,不知道正解是什么。

#include<bits/stdc++.h>
using namespace std;
typedef long long ll; ll sum(int n){
ll ans=0;
for(ll l=1,r;l<=n;l=r+1){
r=n/(n/l);
ans+=(r-l+1)*(n/l);
}
return ans;
} int main() {
#ifdef Yinku
freopen("Yinku.in", "r", stdin);
//freopen("Yinku.out", "w", stdout);
#endif // Yinku
int q;
while(~scanf("%d", &q)) {
for(int qi = 1; qi <= q; qi++) {
int n;
scanf("%d", &n);
printf("Case %d: %s\n", qi, sum(n) & 1 ? "odd" : "even");
}
}
}

B题,不是很懂12小时为什么把0写作12,中午12点是12:00 PM。半夜是12:00 AM。

#include<bits/stdc++.h>
using namespace std;
typedef long long ll; int h, m;
char ap[4];
void input_time() {
scanf("%d:%d %s", &h, &m, ap);
if(strcmp(ap, "AM") == 0) {
if(h == 12)
h -= 12;
} else {
if(h != 12)
h += 12;
}
} void input_city() {
char s1[40], s2[40];
scanf("%s%s", s1, s2);
int dh = 0,dh2;
switch(s1[0]) {
case 'B':
dh = +8;
break;
case 'W':
dh = -5;
break;
case 'L':
dh = 0;
break;
case 'M':
dh = 3;
break;
}
switch(s2[0]) {
case 'B':
dh2 = +8;
break;
case 'W':
dh2 = -5;
break;
case 'L':
dh2 = 0;
break;
case 'M':
dh2 = 3;
break;
}
h+=dh2-dh;
} void output_time() {
if(h<0){
printf("Yesterday ");
h+=24;
}
else if(h>=24){
printf("Tomorrow ");
h-=24;
}
else{
printf("Today ");
} if(h<12){
if(h==0)
h+=12;
strcpy(ap,"AM");
}
else{
if(h!=12)
h-=12;
strcpy(ap,"PM");
}
printf("%d:%02d %s",h,m,ap);
} int main() {
#ifdef Yinku
freopen("Yinku.in", "r", stdin);
//freopen("Yinku.out", "w", stdout);
#endif // Yinku
int q;
while(~scanf("%d", &q)) {
for(int qi = 1; qi <= q; qi++) {
input_time();
input_city();
printf("Case %d: ", qi);
output_time();
putchar('\n');
}
}
}

2018CCPC吉林赛区(重现赛)的更多相关文章

  1. 2018CCPC吉林赛区 hdu6555~hdu6566

    2018CCPC吉林赛区(重现赛)- 感谢北华大学 A 基础数论. #include<bits/stdc++.h> using namespace std; typedef long lo ...

  2. 2018CCPC吉林赛区 | 部分题解 (HDU6555 HDU6556 HDU6559 HDU6561)

    // 杭电上的重现赛:http://acm.hdu.edu.cn/contests/contest_show.php?cid=867 // 杭电6555~6566可交题 A - The Fool 题目 ...

  3. [2018CCPC吉林赛区(重现赛)- 感谢北华大学] 补题记录 躁起来

    1007 High Priestess 埃及分数 1008 Lovers 线段树维护取膜意义下的区间s和. 每个区间保存前缀lazy和后缀lazy. #include <iostream> ...

  4. 2018CCPC吉林赛区(重现赛)部分题解

    The Fool 题目链接 Problem Description The Fool is numbered 0 – the number of unlimited potential –and th ...

  5. 2018CCPC吉林赛区

    传送门 A - The Fool 整除分块即可. B - The World 模拟即可. C - Justice 题意: 给出\(n\)个数\(k_i\),每个数的权值为\(\frac{1}{2^{k ...

  6. 2016ACM/ICPC亚洲区沈阳站-重现赛赛题

    今天做的沈阳站重现赛,自己还是太水,只做出两道签到题,另外两道看懂题意了,但是也没能做出来. 1. Thickest Burger Time Limit: 2000/1000 MS (Java/Oth ...

  7. 2016 CCPC 东北地区重现赛

    1. 2016 CCPC 东北地区重现赛 2.总结:弱渣,只做出01.03.05水题 08   HDU5929 Basic Data Structure    模拟,双端队列 1.题意:模拟一个栈的操 ...

  8. 2016 CCPC长春重现赛

    1.2016中国大学生程序设计竞赛(长春)-重现赛 2.总结:会做的太少,应变能力也不行,或者说猜题目的能力不行 02  水 04  HDU 5914  Triangle 1.题意:1~n,n个数,问 ...

  9. 2016年中国大学生程序设计竞赛(合肥)-重现赛1001 HDU 5961

    传递 Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submiss ...

随机推荐

  1. lua视频教程三套高清新

    目录 1. 下载地址 2. 某网校 Lua 经典教程 3. lua脚本语言零基础开发教程19课全 4. LUA完整视频+Cocos2d-x项目实战 1. 下载地址 https://www.cnblog ...

  2. mysql清空表数据并重置自增ID

    mysql清空表数据并重置自增ID: ## 查看mysql> select * from work_order_company;mysql> show create table work_ ...

  3. python常用模块学习1

    import time time.sleep(1)#暂停时间 time.time()#显示当前系统时间戳 t=time.localtime()#结构化当地时间,可以将结构化时间想象成一个类 print ...

  4. java并发学习--第二章 spring boot实现线程的创建

    除了之前介绍的创建线程方式外,spring boot为我们了提供一套完整的线程创建方式,其中包括了:线程.线程池.线程的监控. 一.使用spring boot提供的方法创建线程与线程池 1.首先在sp ...

  5. web源码泄露

    http://www.am0s.com/ctf/175.html vim 文件泄露 1.备份文件 源文件:index.php 备份文件:index.php~ 2.临时文件 源文件:index.php ...

  6. Django的下载和基本指令

    1.下载Django pip3  install  django     #不写版本号的话,默认使下载最新版的django pip3  install   django == 2.1.2    #指定 ...

  7. js----定义变量的几种方式

    const const定义的变量不可以修改,而且必须初始化 const b = 2 //正确 //const b //错误,没有初始化 console.log('函数外const定义b:' + b); ...

  8. Task3.PyTorch实现Logistic regression

    1.PyTorch基础实现代码 import torch from torch.autograd import Variable torch.manual_seed(2) x_data = Varia ...

  9. [CSP-S模拟测试]:Silhouette(数学)

    题目描述 有一个$n\times n$的网格,在每个格子上堆叠了一些边长为$1$的立方体. 现在给出这个三维几何体的正视图和左视图,求有多少种与之符合的堆叠立方体的方案.两种方案被认为是不同的,当且仅 ...

  10. 将百分制转换为5分制的算法 Binary Search Tree ordered binary tree sorted binary tree Huffman Tree

    1.二叉搜索树:去一个陌生的城市问路到目的地: for each node, all elements in its left subtree are less-or-equal to the nod ...