杭电oj1049 根据规律 写几个就推出来了
来源:互联网 发布:微商做图软件有哪些 编辑:程序博客网 时间:2024/05/29 08:39
#include<iostream>
using namespace std;
int s(int a,int b,int c,int t);
int main()
{
int n,u,d,min=1;
while(cin>>n,cin>>u,cin>>d)
{
if(n==0)
break;
cout<<s(n,u,d,min)<<endl;
}
return 0;
}
int s(int a,int b,int c,int t)
{
int m;
if(t%2!=0)
m=(t+1)/2*b-t/2*c;
if(t%2==0)
m=t/2*b-t/2*c;
if(m>=a)
return t;
else
{
t++;
s(a,b,c,t);
}
}
using namespace std;
int s(int a,int b,int c,int t);
int main()
{
int n,u,d,min=1;
while(cin>>n,cin>>u,cin>>d)
{
if(n==0)
break;
cout<<s(n,u,d,min)<<endl;
}
return 0;
}
int s(int a,int b,int c,int t)
{
int m;
if(t%2!=0)
m=(t+1)/2*b-t/2*c;
if(t%2==0)
m=t/2*b-t/2*c;
if(m>=a)
return t;
else
{
t++;
s(a,b,c,t);
}
}
阅读全文
0 0
- 杭电oj1049 根据规律 写几个就推出来了
- 杭电1005.找规律就好
- 杭电1005 ,之前没遇到过,找到规律之后就蛮容易了。。。。
- oj1049
- (杂) 一写代码就停不下来了。。。。
- 写了几个函数 来防止ntfs.sys被hook
- 困了就来
- 想起来了就写
- iOS8推出了几个新的“controller”
- 你在我心中排第几?(写的太真实了,就转过来了)
- 杭电 1021 找规律
- JS Collection--javascript 集合类( 在使用Comet来进行数据交互时根据网上的资源写了几个集合类。自我感觉还比较好用,呵呵! )
- 就这样秋天来了
- 2012,就这样,来了,
- 一大清早就来公司了,利用吃早餐的时间写编LOG先。
- 看一个反向链表都没看懂,就写了下代码来测一下对不对
- (⊙v⊙)写了题就发到这里来吧
- 为了双11写了几个来替代手工的瑕疵品
- 略谈OpenGL中的共享上下文(EGL Context)
- 关于R语言创建pdf文本和txt文本的一些问题
- 综合除法和余数定理
- android studio gradle 命令行
- SpringBoot开发详解(十二) -- SpringBoot中执行定时任务
- 杭电oj1049 根据规律 写几个就推出来了
- 杭电oj1040 简单的排序
- 51nod1089---最长回文子串 V2(51nod基础:Manacher算法)
- Linux---lnmp之mysql
- 【shell】head/tail及常见用法
- 《零基础入门学习Python》学习过程笔记【017函数】
- 利用Angular2的Observables实现交互控制
- 移动端一像素边框
- Angular4示例--数据显示