JZOJ 3461. 【NOIP2013模拟联考5】小麦亩产一千八(kela)
3461. 【NOIP2013模拟联考5】小麦亩产一千八(kela) (Standard IO)
Description
Input
对于每一组数据仅一行,3 个正整数a,x,b,分别表示第a 个格子放了x 粒小麦,以及你所需要计算的是第b 个格子的小麦数量。
Output
Sample Input
1 1 2
3 5 4
3 4 6
12 17801 19
Sample Output
2
8
-1
516847
【样例解释】
对于样例二,f[1]=2 时,能够满足f[3]=5,因此宰相没有撒谎,此时第5 个格子的小麦数应为f[4]=f[2]+f[3]=3+5=8.
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#define LL long long
using namespace std;
LL a, b, x;
LL f[]; LL max(LL a, LL b){
return a > b ? a : b;
} void pre_work()
{
f[] = ;
for (int i = ; i <= ; i++)
f[i] = f[i - ] + f[i - ];
} int main()
{
pre_work();
while (~scanf("%lld%lld%lld", &a, &x, &b))
{
LL f1 = ;
if ((x - f[max(a - , )]) % f[max(a, )] != )
{
printf("-1\n");
continue;
}
f1 = (x - f[max(a - , )]) / f[max(a, )];
printf("%lld\n", f[max(b, )] * f1 + f[max(b - , )]);
}
}
JZOJ 3461. 【NOIP2013模拟联考5】小麦亩产一千八(kela)的更多相关文章
- JZOJ【NOIP2013模拟联考14】隐藏指令
JZOJ[NOIP2013模拟联考14]隐藏指令 题目 Description 在d维欧几里得空间中,指令是一个长度为2N的串.串的每一个元素为d个正交基的方向及反方向之一.例如,d = 1时(数轴) ...
- JZOJ 3493. 【NOIP2013模拟联考13】三角形
3493. [NOIP2013模拟联考13]三角形(triangle) (File IO): input:triangle.in output:triangle.out Time Limits: 10 ...
- JZOJ 3487. 【NOIP2013模拟联考11】剑与魔法(dragons)
3487. [NOIP2013模拟联考11]剑与魔法(dragons) (Standard IO) Time Limits: 1000 ms Memory Limits: 131072 KB De ...
- JZOJ 3470. 【NOIP2013模拟联考8】最短路(path)
470. [NOIP2013模拟联考8]最短路(path) (Standard IO) Time Limits: 1000 ms Memory Limits: 262144 KB Detailed ...
- JZOJ 3463. 【NOIP2013模拟联考5】军训
3463. [NOIP2013模拟联考5]军训(training) (Standard IO) Time Limits: 2000 ms Memory Limits: 262144 KB Deta ...
- JZOJ 3462. 【NOIP2013模拟联考5】休息(rest)
3462. [NOIP2013模拟联考5]休息(rest) (Standard IO) Time Limits: 1000 ms Memory Limits: 262144 KB Detailed ...
- 【NOIP2013模拟联考7】OSU
[NOIP2013模拟联考7]OSU 描述 Description osu 是一款群众喜闻乐见的休闲软件. 我们可以把osu的规则简化与改编成以下的样子: 一共有n次操作,每次操作只有成功与失败之分, ...
- [jzoj]3468.【NOIP2013模拟联考7】OSU!(osu)
Link https://jzoj.net/senior/#main/show/3468 Description osu 是一款群众喜闻乐见的休闲软件. 我们可以把osu的规则简化与改编成以下的样子: ...
- [jzoj]3456.【NOIP2013模拟联考3】恭介的法则(rule)
Link https://jzoj.net/senior/#main/show/3456 Description 终于,在众亲们的奋斗下,最终boss 恭介被关进了库特设计的密室.正当她们松了一口气时 ...
随机推荐
- pat1069. The Black Hole of Numbers (20)
1069. The Black Hole of Numbers (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, ...
- liunx下文件授权可执行权限chmod
Cannot find ./catalina.sh The file is absent or does not have execute permission This file is needed ...
- HQL语句中的join fetch
from Paper as paper join fetch paper.authors as authors where authors.id='xxxx'; from Paper as paper ...
- IIS错误HTTP 错误 500.21 - Internal Server Error
原因:在安装Framework v4.0之后,再启用IIS,导致Framework没有完全安装 解决:以管理员身份运行cmd->输入“%windir%\Microsoft.NET\Framewo ...
- 客户端设置WebService调用超时时间
刚接触WebService,对如何在客户端设置WebService调用超时时间查阅了一些资料,现总结如下: ============================================== ...
- HDU4352 XHXJ's LIS(LIS 状压)
题意 题目链接 Sol 刚开始的思路是\(f[i][j]\)表示到第\(i\)位,LIS长度为\(j\)的方案. 然而发现根本不能转移,除非知道了之前的状态然后重新dp一遍.. 题解,,,挺暴力的把, ...
- 1269 匈牙利游戏 2012年CCC加拿大高中生信息学奥赛
1269 匈牙利游戏 2012年CCC加拿大高中生信息学奥赛 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 钻石 Diamond 题目描述 Description ...
- python基本数据类型,int,bool,str
一丶python基本数据类型 1.int 整数,主要用来进行数学运算. 2.str 字符串,可以保存少量数据并进行相应的操作 3.bool 判断真假.True.False 4.list 存储大量数据, ...
- 构建第一个Spring Boot2.0应用之项目创建(一)
1.开发环境 IDE: JAVA环境: Tomcat: 2.使用Idea生成spring boot项目 以下是使用Idea生成基本的spring boot的步骤. (1)创建工程第一步 (2)创建工 ...
- 微信iOS端无法执行jquery on()方法
微信iOS端无法执行jquery on()方法,click方法可以, 如下代码是不会执行的: $(function(){ $('body').on('click','.cka',function(){ ...