HDU 5867 Water problem ——(模拟,水题)
我发这题只是想说明:有时候确实需要用水题来找找自信的~
代码如下:
- #include <stdio.h>
- #include <algorithm>
- #include <string.h>
- using namespace std;
- typedef long long ll;
- int num[+] = {,,,,,,,,,,,,,,,,,,,,};
- int sum[+];
- void init()
- {
- for(int i=;i<=;i++) num[i] = + num[i-];
- num[] = ;
- for(int i=;i<=;i++) num[i] = + num[i-];
- num[] = ;num[] = ;num[] = ;num[] = ;num[] = ;num[] = ;
- for(int i = ;i<=;i++)
- {
- if(i%==) continue;
- else num[i] = num[i-i%] + num[i%];
- }
- num[] = ;
- for(int i=;i<=;i++)
- {
- if(i%==)
- {
- num[i] = num[i/] + ;
- }
- else
- {
- num[i] = ;
- num[i] += num[i-i%] + num[i%];
- }
- }
- num[] = ;
- for(int i=;i<=;i++) sum[i] = sum[i-] + num[i];
- }
- int main()
- {
- init();
- int T;scanf("%d",&T);
- while(T--)
- {
- int n;scanf("%d",&n);
- printf("%d\n",sum[n]);
- }
- }
HDU 5867 Water problem ——(模拟,水题)的更多相关文章
- HDU 5867 Water problem (模拟)
Water problem 题目链接: http://acm.split.hdu.edu.cn/showproblem.php?pid=5867 Description If the numbers ...
- HDU 5443 The Water Problem (水题,暴力)
题意:给定 n 个数,然后有 q 个询问,问你每个区间的最大值. 析:数据很小,直接暴力即可,不会超时,也可以用RMQ算法. 代码如下: #include <cstdio> #includ ...
- HDU 5832 A water problem (水题,大数)
题意:给定一个大数,问你取模73 和 137是不是都是0. 析:没什么可说的,先用char 存储下来,再一位一位的算就好了. 代码如下: #pragma comment(linker, "/ ...
- zzulioj--1634--Happy Thanksgiving Day - A + B Problem(模拟水题)
1634: Happy Thanksgiving Day - A + B Problem Time Limit: 1 Sec Memory Limit: 128 MB Submit: 136 ...
- HDU 5867 Water problem
处理出1-99的,之后的加上多少hundred和and即可.整百和一千的时候注意一下. #pragma comment(linker, "/STACK:1024000000,10240000 ...
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- fzuoj Problem 2182 水题
http://acm.fzu.edu.cn/problem.php?pid=2182 Problem 2182 水题 Accept: 188 Submit: 277Time Limit: 100 ...
- POJ 2014:Flow Layout 模拟水题
Flow Layout Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 3091 Accepted: 2148 Descr ...
- HDU 5538 L - House Building 水题
L - House Building Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...
随机推荐
- sql当前时间往后半年
select DATEADD(MONTH, -6, GETDATE()) select DATEADD(hh, -6, GETDATE())
- vue响应原理
用Object.defineProperty添加属性的方法,给属性加get set方法.当我们操作属性的时候其实底层是在操作dom. <!DOCTYPE html> <html la ...
- opencv 模板匹配, 已解决模板过大程序不工作的bug
#include <opencv2/opencv.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv ...
- STM32F10xxx_Keil中添加的预定义宏
目录 STM32F10xxx_Keil中添加的预定义宏 更新记录 STM32F10xxx_Keil中添加的预定义宏 更新记录 version status description date autho ...
- npm 设置淘宝镜像
永久 npm config set registry https://registry.npm.taobao.org 直接安装 cnpm 替代 npm npm install -g cnpm --re ...
- springboot2.0集成webSocket
WebSocket和http的区别? http协议是用在应用层的协议,他是基于tcp协议的,http协议建立链接也必须要有三次握手才能发送信息. http链接分为短链接,长链接,短链接是每次请求都要三 ...
- Python中文转为拼音
# -*- coding: utf-8 -*-import sys def openTable(): f = open('gb-pinyin.table', 'r') table = f.read() ...
- 解决xshell连接不上阿里云服务器问题
最近购买了阿里云服务器准备玩玩,但是使用xshell连接阿里云服务器时,系统一直提示“Connection established. To escape to local shell, press ' ...
- BLE 5协议栈-属性协议层(ATT)
文章转载自:http://www.sunyouqun.com/2017/04/page/2/ 属性协议(Attribute Protocol)简称ATT. ATT层定义了属性实体的概念,包括UUID. ...
- 一、CentOS 7安装部署GitLab服务器
一.CentOS 7安装部署GitLab服务器 1.安装依赖软件 yum -y install policycoreutils policycoreutils-python openssh-serve ...