CF#712 C. Memory and De-Evolution (数学)
来源:互联网 发布:简单效果图制作软件 编辑:程序博客网 时间:2024/06/06 10:00
题目点我点我点我
题目大意:给你一个长度为x的等边三角形,每一秒你能修改一条边的长度,要你修改到长度为y的等边三角形,要求修改过程中保证它是一个三角形。
解题思路:从y开始倒着往x推。
/* ***********************************************┆ ┏┓ ┏┓ ┆┆┏┛┻━━━┛┻┓ ┆┆┃ ┃ ┆┆┃ ━ ┃ ┆┆┃ ┳┛ ┗┳ ┃ ┆┆┃ ┃ ┆┆┃ ┻ ┃ ┆┆┗━┓ 马 ┏━┛ ┆┆ ┃ 勒 ┃ ┆ ┆ ┃ 戈 ┗━━━┓ ┆┆ ┃ 壁 ┣┓┆┆ ┃ 的草泥马 ┏┛┆┆ ┗┓┓┏━┳┓┏┛ ┆┆ ┃┫┫ ┃┫┫ ┆┆ ┗┻┛ ┗┻┛ ┆************************************************ */#include <stdio.h>#include <string.h>#include <iostream>#include <algorithm>#include <vector>#include <queue>#include <stack>#include <set>#include <map>#include <string>#include <math.h>#include <stdlib.h>#include <bitset>using namespace std;#define rep(i,a,b) for (int i=(a),_ed=(b);i<=_ed;i++)#define per(i,a,b) for (int i=(b),_ed=(a);i>=_ed;i--)#define pb push_back#define mp make_pairconst int inf_int = 2e9;const long long inf_ll = 2e18;#define inf_add 0x3f3f3f3f#define mod 1000000007#define LL long long#define ULL unsigned long long#define MS0(X) memset((X), 0, sizeof((X)))#define SelfType intSelfType Gcd(SelfType p,SelfType q){return q==0?p:Gcd(q,p%q);}SelfType Pow(SelfType p,SelfType q){SelfType ans=1;while(q){if(q&1)ans=ans*p;p=p*p;q>>=1;}return ans;}#define Sd(X) int (X); scanf("%d", &X)#define Sdd(X, Y) int X, Y; scanf("%d%d", &X, &Y)#define Sddd(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)#define reunique(v) v.resize(std::unique(v.begin(), v.end()) - v.begin())#define all(a) a.begin(), a.end()typedef pair<int, int> pii;typedef pair<long long, long long> pll;typedef vector<int> vi;typedef vector<long long> vll;inline int read(){int ra,fh;char rx;rx=getchar(),ra=0,fh=1;while((rx<'0'||rx>'9')&&rx!='-')rx=getchar();if(rx=='-')fh=-1,rx=getchar();while(rx>='0'&&rx<='9')ra*=10,ra+=rx-48,rx=getchar();return ra*fh;}//#pragma comment(linker, "/STACK:102400000,102400000")int main(){//freopen("in.txt","r",stdin);//freopen("out.txt","w",stdout);ios::sync_with_stdio(0);cin.tie(0);int x,y; x = read(), y = read(); int a,b,c; a = b = c = y; int ans = 0; while(a<x) { swap(a,b); swap(b,c); c = a + b - 1; ans++; } printf("%d\n",ans);return 0;}
0 0
- CF#712 C. Memory and De-Evolution (数学)
- [CF 712C] Memory and De-Evolution
- CF#712 C. Memory and De-Evolution(水题)
- CF 712C. Memory and De-Evolution 贪心
- codeforces 712-C. Memory and De-Evolution(数学+逆推)
- Codeforces-712C-Memory and De-Evolution
- Codeforces 712C Memory and De-Evolution
- Codeforce - 712 -C. Memory and De-Evolution
- CodeForces 712 C. Memory and De-Evolution(贪心)
- CodeForces712C Memory and De-Evolution 数学+贪心
- Codeforces Round #370 (Div. 2)C. Memory and De-Evolution(数学,思维))
- codeforces 712C C. Memory and De-Evolution(贪心)
- CodeForces 712C - Memory and De-Evolution 逆向思维
- 【Codeforces 712 C. Memory and De-Evolution】+ 贪心
- codeforces C. Memory and De-Evolution
- CodeForces 712C Memory and De-Evolution(逆推,新思路)
- Codeforces Round #370 (Div. 2)-C. Memory and De-Evolution
- Codeforces Round #370 (Div. 2) C. Memory and De-Evolution
- 解决windows server 2008 R2安装到D盘的问题
- usaco 3.1 Humble Numbers
- html 页面超出范围没有自动出现滚动条
- 读入一系列整数,统计出正整数个数i和负整数个数j,读入0则结束
- ++和--前后位置不同的区别
- CF#712 C. Memory and De-Evolution (数学)
- wine----Ubuntu下打开exe等windows下的应用程序
- wire与reg的区别?什么时候用wire?什么时候用reg?
- 如何用bat脚本自动注册bat目录下的文件
- HTML/CSS:编写合法HTML页面简明指南
- @RequestMapping对于url的影响
- super()和this()的区别和用法
- 为什么把String设计成不可变对象
- 硬币问题