【HDOJ6308】Time Zone(模拟)
题意:
以"UTC+X'', "UTC-X'', "UTC+X.Y'', or "UTC-X.Y'' 四种格式给定当地时间,要求转换为北京时间
思路:Gold_7写的
我自己转C后字符串处理的模拟题并不熟练啊
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define fi first
#define se second
#define MP make_pair int read()
{
int v = , f = ;
char c = getchar();
while (c < || < c) {if (c == '-') f = -; c = getchar();}
while ( <= c && c <= ) v = (v << ) + v + v + c - , c = getchar();
return v * f;
} char ch[]; int main()
{
int cas = read();
while (cas--)
{
int x = read(), y = read();
scanf("%s", ch);
int flag=;
int p = , q = ;
if (ch[]=='-')flag=-;
p = p * + ch[] - '';
if (ch[])
{
if (ch[] != '.')
{
p = p * + ch[] - '';
if (ch[] == '.')
q = ch[] - '';
} else
{
q = ch[] -'';
}
}
p*=flag;q*=flag;
p -= ;
x += p;
y += q * ;
x += y / ;
y %= ;
if (y<){x--;y+=;}
x = (x % + ) % ;
printf("%02d:%02d\n", x, y);
for (int i = ; ch[i]; i++)
ch[i] = ;
}
}
【HDOJ6308】Time Zone(模拟)的更多相关文章
- Time Zone 【模拟时区转换】(HDU暑假2018多校第一场)
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6308 Time Zone Time Limit: 2000/1000 MS (Java/Others) ...
- hdu 6308 Time Zone (模拟+字符串处理)
Time Zone Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total S ...
- 【FLUENT案例】04:利用DDPM+DEM模拟鼓泡流化床
1 引言2 问题描述3 准备4 FLUENT前处理 1 引言 DEM碰撞模型扩展了DPM模型的功能,能够用于稠密颗粒流动的模拟.该模型可以与DDPM(Dense DPM)模型何用以模拟颗粒对主相的阻碍 ...
- sqlmap --dns-domain模拟实践
因为看到乌云的这一篇文章 http://drop.xbclub.org/static/drops/tips-5283.html 里面的提到的用sqlmap 的--dns-domain 进行dns 注入 ...
- Zone.js 简介 & 抛砖引玉
Zone.js是angular团队参照NodeJS的Domain,Dart的Zone,为angular 2开发的核心组件. 一开始,我对Zone.js是拒绝的.我们知道类似的 Domain 模块,主要 ...
- PhoenixFD插件流体模拟——UI布局【Rendering】详解
Liquid Rendering 流体渲染 本文主要讲解Rendering折叠栏中的内容.原文地址:https://docs.chaosgroup.com/display/PHX3MAX/Liqui ...
- PhoenixFD插件流体模拟——UI布局【Gird】详解
流体网格 本文主要讲解Grid折叠栏中的内容 主要内容 Overview 综述 Parameters 参数 General 普通参数 Example: Scene Scale Example: Gri ...
- python--selenium简单模拟百度搜索点击器
python--selenium简单模拟百度搜索点击器 发布时间:2018-02-28 来源:网络 上传者:用户 关键字: selenium 模拟 简单 点击 搜索 百度 发表文章摘要:用途:简单模拟 ...
- 用Qemu模拟vexpress-a9 (一) --- 搭建Linux kernel调试环境【转】
转自:http://www.cnblogs.com/pengdonglin137/p/5023342.html#_label2 阅读目录(Content) 环境介绍: 下载Linux内核 安装arm的 ...
随机推荐
- 安装mysql时 make 时 提示 redeclaration of C++ built-in type ‘bool’ 错误
安装mysql时 make 时 提示 redeclaration of C++ built-in type ‘bool’ 错误 由于gcc-c++是在./configure后进行编译的 重新./con ...
- Oracle | Java日期处理
public class Test{ public static void main (String args []){ j ...
- 微信小程序开发系列五:微信小程序中如何响应用户输入事件
微信小程序开发系列教程 微信小程序开发系列一:微信小程序的申请和开发环境的搭建 微信小程序开发系列二:微信小程序的视图设计 微信小程序开发系列三:微信小程序的调试方法 微信小程序开发系列四:微信小程序 ...
- uva11925 Generating Permutations
逆序做,逆序输出 紫书上的描述有点问题 感觉很经典 ans.push_back(2); a.insert(a.begin(),a[n-1]); a.erase(a.end()-1); a.push_b ...
- chart 图片组件 生成后不能动态更新,需要销毁dom,从新载入 用 v-if 和 this.$nextTick(() => {
<chart-box v-if="cbData1Bool" cb-text="基本概况" chartBoxSele="饼状图" :cb ...
- 【整理】treeGrid 树形表格
treeGrid 树形表格 https://fly.layui.com/extend/treeGrid/
- postman的关联,即如何在请求中引用上次请求返回的值
做接口测试,一定会遇到这种情况,需要拿上次请求的值在本次请求中使用,比如,我们去测试一个东西,要去登录才能做其他的操作,需要拿到登录返回数据中的某些字段,比如,token啊等... 如果发一次请求,就 ...
- C++静态全局变量和全局变量的区别
静态全局变量 非静态全局变量 存储方式 静态存储 静态存储 作用域 定义该变量的源文件内 所有源文件 解释: 共同点:全局变量(外部变量)的说明之前再冠以static 就构 成了静态的全局变量.全 ...
- Hibernate5.x版本HQL限定查询 Legacy-style query parameters (`?`) are no longer supported
在此版本的限定查询和4.0版本的限定查询: 如果查询语句是: String hql = "select u from User u where u.gender = ?"; 会出现 ...
- 深度学总结:skip-gram pytorch实现
文章目录 skip-gram pytorch 朴素实现网络结构训练过程:使用nn.NLLLoss()batch的准备,为unsupervised,准备数据获取(center,contex)的pair: ...