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. thinkphp 模板变量输出替换和赋值

    一.变量输出的几个方法 <?php namespace app\index\controller; use http\Params; use think\Config; use think\Co ...

  2. 2020年的ARM处理器将超越英特尔

    2020年ARM真的会超越英特尔成为世界芯片霸主吗?迄今为止,基于ARM的笔记本电脑一直很流行,但在一两年内你可能会对它们产生不同的印象.该公司对其未来的处理器架构的性能预期提供了一个罕见的看法,这些 ...

  3. Centos7防火墙和SELinux的开启和关闭

    在虚拟机里面开启多个服务,对应多个端口,在防火墙开启的情况下,就要对外开放端口,这样客户端才能正常访问,但比较繁琐,关闭更直接点. 防火墙 临时关闭防火墙 systemctl stop firewal ...

  4. 20180711-Java Number类

    下面是一个装箱与拆箱的例子: public class Test{ public static void main(String args[]){ Integer x = 5; // boxes in ...

  5. RabbitMQ-Window安装(一)

    1.登录RabbitMq官网http://www.rabbitmq.com/ 2.点击Get Started 3.点击Download+Installation 4.找到Windows,点击 5.点击 ...

  6. <!DOCTYPE>是什么

    所有浏览器都支持<!DOCTYPE> 概念 是指web浏览器关于页面使用哪个html版本进行编写的指令. 常用DOCTYPE声明 html 5 <!DOCTYPE html> ...

  7. C# get和set

    Day1:知识点 1.封装 自己的理解: 可复用,低耦合.就是拿过来就用 只需要关注名称,返回值,参数及参数类型,不需要知道里面怎么实现的. 字段封装的快捷键 (ctrl+r+e)  将光标放在将要封 ...

  8. leetcode 78. 子集(c++)

    给定一组不含重复元素的整数数组 nums,返回该数组所有可能的子集(幂集). 说明:解集不能包含重复的子集. 示例: 输入: nums = [1,2,3]输出:[ [3],  [1],  [2],  ...

  9. redhat 修改yum源

    问题现象: 现有的yum安装git失败,提示yum源连接失败 Error Downloading Packages: git--.el6_4..x86_64: failure: Packages/gi ...

  10. Webhook到底是个啥?

    参照: https://segmentfault.com/a/1190000015437514