Codeforces 458A Golden System
经过计算两个字符串的大小对比 主要q^2=q+1 明明是斐波那契数
100000位肯定超LL 我在每一位仅仅取到两个以内 竟然ac了
#include<bits/stdc++.h>
using namespace std;
int a[100020];
char s1[100020],s2[100020];
int main()
{
scanf("%s%s",s1,s2);
int len1=strlen(s1),len2=strlen(s2);
for(int i=len1-1;i>=0;i--)
{
if(s1[i]=='1')
a[len1-i-1]++;
}
for(int i=len2-1;i>=0;i--)
{
if(s2[i]=='1')
a[len2-i-1]--;
}
for(int i=100000;i>=2;i--)
{
if(a[i]==1)
{
a[i-1]++;
a[i-2]++;
}
else if(a[i]>=2)
{
a[i-1]+=2;
a[i-2]+=2;
}
else if(a[i]==-1)
{
a[i-1]--;
a[i-2]--;
}
else if(a[i]<=-2)
{
a[i-1]-=2;
a[i-2]-=2;
}
a[i]=0;
}
double x=(sqrt(5)+1)/2;
if(a[1]*x+a[0]>0)
printf(">\n");
else if(a[1]*x+a[0]<0)
printf("<\n");
else
printf("=\n");
return 0;
}
版权声明:本文博客原创文章,博客,未经同意,不得转载。
Codeforces 458A Golden System的更多相关文章
- (水题)Codeforces - 4C - Registration system
https://codeforces.com/problemset/problem/4/C 用来哈希的一道题目,用map也可以强行过,但是性能慢了6倍,说明是在字符串比较的时候花费了接近6倍的时间. ...
- 【codeforces 22C】 System Administrator
[题目链接]:http://codeforces.com/problemset/problem/22/C [题意] 给你n个点; 要求你构造一个含m条边的无向图; 使得任意两点之间都联通; 同时,要求 ...
- codeforces C. Booking System
题意:有n组客人,分别告诉每一组的个数和花费,然后给你餐厅内k个桌子,每个桌子的最大容纳人数,如何安排使得餐厅最大收益并且容纳人数尽可能大: 思路:贪心,对花费排序,然后对每一组客人找桌子就可以. # ...
- Codeforces 1321D Navigation System
题意 有个人要从\(s\)走到\(t\),经过的路径给定.导航系统每次会显示当前节点到\(t\)的最短路,有多条就显示其中之一.这个人如果按照导航走,那么啥都没变.如果没有按导航走导航就会重新导航.问 ...
- MemSQL Start[c]UP 2.0 - Round 2 - Online Round
搞到凌晨4点一个没出,要gg了. A. Golden System http://codeforces.com/contest/458/problem/A #include<cstdio> ...
- CF memsql Start[c]UP 2.0 A
CF memsql Start[c]UP 2.0 A A. Golden System time limit per test 1 second memory limit per test 256 m ...
- Codeforces Round #313 (Div. 2) A. Currency System in Geraldion
A. Currency System in Geraldion Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/co ...
- CodeForces 527B Error Correct System
Error Correct System Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I6 ...
- Codeforces Beta Round #4 (Div. 2 Only) C. Registration system hash
C. Registration system Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset ...
随机推荐
- 【Codeforces Round #439 (Div. 2) B】The Eternal Immortality
[链接] 链接 [题意] 求b!/a!的最后一位数字 [题解] b-a>=20的话 a+1..b之间肯定有因子2和因子5 答案一定是0 否则暴力就好 [错的次数] 在这里输入错的次数 [反思] ...
- embed-it_Integrator memory compile工具使用之二
embed-it_Integrator memory compile工具使用之二 主要内容 使用ish接口自动加载memory的cfg文件运行生成memory 脚本内容 打开Integrate &am ...
- [Recompose] Add Local State to a Functional Stateless Component using Recompose
Learn how to use the 'withState' and 'withHandlers' higher order components to easily add local stat ...
- 【solr基础教程之九】客户端 分类: H4_SOLR/LUCENCE 2014-07-30 15:28 904人阅读 评论(0) 收藏
一.Java Script 1.由于Solr本身可以返回Json格式的结果,而JavaScript对于处理Json数据具有天然的优势,因此使用JavaScript实现Solr客户端是一个很好的选择. ...
- Android CursorAdapter的使用详解
一.CursorAdapter介绍 CursorAdapter这个类是继承于BaseAdapter的它是一个虚类它为Cursor和ListView连接提供了桥梁 二.CursorAdapter详解 1 ...
- [CSS] Build Responsive CSS Layouts with Tachyons
Building responsive css layouts is critical in any modern website. Tachyons makes this easy by desig ...
- 后台报错java.lang.IllegalArgumentException: Invalid character found in the request target.
报错: Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level. java.lang ...
- JavaScript学习笔记八
本文依据慕课网课程<JavaScript进阶>学习整理 第8章 浏览器对象 8-1 window对象 window对象是BOM的核心.window对象指当前的浏览器窗体. wind ...
- Eclipse离线单独安装hibernate tools成功率低
原因:单独下载的hibernate tools插件应该缺少部分需要的组件,安装时,边联网,成功率很低 解决方法:下载jboss tools的全插件包,安装时,只选择hibernate tools插件可 ...
- easyexcel 读写测试
<dependencies> <dependency> <groupId>com.alibaba</groupId> <artifactId> ...