经过计算两个字符串的大小对比 主要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的更多相关文章

  1. (水题)Codeforces - 4C - Registration system

    https://codeforces.com/problemset/problem/4/C 用来哈希的一道题目,用map也可以强行过,但是性能慢了6倍,说明是在字符串比较的时候花费了接近6倍的时间. ...

  2. 【codeforces 22C】 System Administrator

    [题目链接]:http://codeforces.com/problemset/problem/22/C [题意] 给你n个点; 要求你构造一个含m条边的无向图; 使得任意两点之间都联通; 同时,要求 ...

  3. codeforces C. Booking System

    题意:有n组客人,分别告诉每一组的个数和花费,然后给你餐厅内k个桌子,每个桌子的最大容纳人数,如何安排使得餐厅最大收益并且容纳人数尽可能大: 思路:贪心,对花费排序,然后对每一组客人找桌子就可以. # ...

  4. Codeforces 1321D Navigation System

    题意 有个人要从\(s\)走到\(t\),经过的路径给定.导航系统每次会显示当前节点到\(t\)的最短路,有多条就显示其中之一.这个人如果按照导航走,那么啥都没变.如果没有按导航走导航就会重新导航.问 ...

  5. MemSQL Start[c]UP 2.0 - Round 2 - Online Round

    搞到凌晨4点一个没出,要gg了. A. Golden System http://codeforces.com/contest/458/problem/A #include<cstdio> ...

  6. 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 ...

  7. 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 ...

  8. CodeForces 527B Error Correct System

    Error Correct System Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I6 ...

  9. 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 ...

随机推荐

  1. 最小生成树(MST)求解旅行商问题

    从当前位置开始(也可以不指定起始位置),访问完所有未访问的端点后返回起始点的最短路径就是连接所有端点的生成树.最小生成树需保证: 每条边最多只能被选 1 次: 抹掉所有未被选择的边时,图形不能分为上下 ...

  2. 在vue中使用font-awesome

    1.安装 cnpm i font-awesome -S 2.在main.js中引入 import 'font-awesome/css/font-awesome.min.css'

  3. Spring Tool Suite(STS)加速

    Java开发首选技术是Spring,使用Spring技术首选的开发工具是STS,STS有许多加速spring开发的提示和快捷方式,并将spring的最新技术通过STS快速简单的传递给用户. 但是STS ...

  4. [D3] Create Labels from Numeric Data with Quantize Scales in D3 v4

    Sometimes data needs to be converted from a continuous range, like test scores, to a discrete set of ...

  5. 什么是uuid以及uuid在java中的使用

    什么是UUID?UUID是Universally Unique Identifier的缩写,它是在一定的范围内(从特定的名字空间到全球)唯一的机器生成的标识符.UUID具有以下涵义: 经由一定的算法机 ...

  6. PatentTips - Sprite Graphics Rendering System

    BACKGROUND This disclosure relates generally to the field of computer graphics. More particularly, b ...

  7. [Angular Router] Lazy loading Module with Auxiliary router

    Found the way to handle Auxiliary router for lazy loading moudle and erge load module are different. ...

  8. ios开发多选照片实现

    #import "ViewController.h" #import <Photos/Photos.h> @interface ViewController () &l ...

  9. js获取滚动条的宽度

    function getScrollWidth() { var noScroll, scroll, oDiv = document.createElement("DIV"); oD ...

  10. Methods and systems to control virtual machines

    Methods and systems are provided to control the execution of a virtual machine (VM). A VM Monitor (V ...