2018CCPC吉林赛区(重现赛)
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吉林赛区(重现赛)的更多相关文章
- 2018CCPC吉林赛区 hdu6555~hdu6566
2018CCPC吉林赛区(重现赛)- 感谢北华大学 A 基础数论. #include<bits/stdc++.h> using namespace std; typedef long lo ...
- 2018CCPC吉林赛区 | 部分题解 (HDU6555 HDU6556 HDU6559 HDU6561)
// 杭电上的重现赛:http://acm.hdu.edu.cn/contests/contest_show.php?cid=867 // 杭电6555~6566可交题 A - The Fool 题目 ...
- [2018CCPC吉林赛区(重现赛)- 感谢北华大学] 补题记录 躁起来
1007 High Priestess 埃及分数 1008 Lovers 线段树维护取膜意义下的区间s和. 每个区间保存前缀lazy和后缀lazy. #include <iostream> ...
- 2018CCPC吉林赛区(重现赛)部分题解
The Fool 题目链接 Problem Description The Fool is numbered 0 – the number of unlimited potential –and th ...
- 2018CCPC吉林赛区
传送门 A - The Fool 整除分块即可. B - The World 模拟即可. C - Justice 题意: 给出\(n\)个数\(k_i\),每个数的权值为\(\frac{1}{2^{k ...
- 2016ACM/ICPC亚洲区沈阳站-重现赛赛题
今天做的沈阳站重现赛,自己还是太水,只做出两道签到题,另外两道看懂题意了,但是也没能做出来. 1. Thickest Burger Time Limit: 2000/1000 MS (Java/Oth ...
- 2016 CCPC 东北地区重现赛
1. 2016 CCPC 东北地区重现赛 2.总结:弱渣,只做出01.03.05水题 08 HDU5929 Basic Data Structure 模拟,双端队列 1.题意:模拟一个栈的操 ...
- 2016 CCPC长春重现赛
1.2016中国大学生程序设计竞赛(长春)-重现赛 2.总结:会做的太少,应变能力也不行,或者说猜题目的能力不行 02 水 04 HDU 5914 Triangle 1.题意:1~n,n个数,问 ...
- 2016年中国大学生程序设计竞赛(合肥)-重现赛1001 HDU 5961
传递 Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submiss ...
随机推荐
- ES常见错误
1. Request cannot be executed; I/O reactor status: STOPPED RestClient被关闭了 2. SpringBoot启动后 Stopping ...
- spring data jpa和spring data redis同时配置时,出现Multiple Spring Data modules found, entering strict repository configuration mode错误
问题说明 data jpa和data redis同时配置时,出现Spring modules spring Spring Data Release Train <dependencyManage ...
- Spring Boot 全局排除 spring-boot-starter-logging 依赖
https://blog.csdn.net/u013314786/article/details/90412733 项目里使用了log4j2做日志处理,要排除掉Spring Boot 很多jar里边默 ...
- 基于TMS320C6678、FPGA XC5VLX110T的6U CPCI 8路光纤信号处理卡
基于TMS320C6678.FPGA XC5VLX110T的6U CPCI 8路光纤信号处理卡 1.板卡概述 本板卡由我公司自主研发,基于CPCI架构,符合CPCI2.0标准,采用两片TI DSP T ...
- intraweb首次与LayUI结合
intraweb可以说是Delphi Web开发的好帮手,但是自带的控件搭建页面,感觉不是那么美观,于是想引用一个UI框架,Delphi来提供后台访问,但是发现一个问题,如果intraweb用模版,L ...
- orm中 如何模糊匹配某一年的用户和某一事时间段的用户
导入Q查询
- python学习笔记(十五)python操作数据库
1.连接mysql,ip,端口号,密码,账号,数据库 2.建立游标 3.执行sql 4.获取结果 5.关闭连接,关闭游标 游标打开仓库的大门: import pymysql conn=pymysql. ...
- Python 爬虫实战(1):分析豆瓣中最新电影的影评
目标总览 主要做了三件事: 抓取网页数据 清理数据 用词云进行展示 使用的python版本是3.6 一.抓取网页数据 第一步要对网页进行访问,python中使用的是urllib库.代码如下: from ...
- Codeforces 846F - Random Query
原题链接:http://codeforces.com/contest/846/problem/F 题意:给一个数列,任意取区间[l, r],问区间内不同数字的个数的期望是多少. 思路: 对于第i个数a ...
- 虚拟机CentOS7安装docker并搭建Gitlab私服
一.下载安装虚拟机和CentOS7系统 这些流程比较简单不会有什么坑,这里不再阐述 二.安装docker 1.Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看本页面的前提条件来验 ...