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 ...
随机推荐
- 如何在 Linux 中统计一个进程的线程数
编译自:http://ask.xmodulo.com/number-of-threads-process-linux.html作者: Dan Nanni原创:LCTT https://linux.cn ...
- linux下如何获取每个线程的CPU占用率
啥也不说,直接上脚本: root@Storage:/mnt/mtd# cat cpu.sh #!/bin/sh while truedo ps -H -eo user,pid,ppid, ...
- 卸载、指定卸载 .NET Core Runtime and SDK
原文:卸载.指定卸载 .NET Core Runtime and SDK 项目使用的 Nuget 包,比如 Microsoft.AspNetCore.App等的版本号要与 .NET Core 版本号( ...
- 标准模板库(STL) map —— 初始化问题
map 容器没有:.reverse成员: map 是关联式容器,会根据元素的键值自动排序: map 容器不是连续的线性空间: 标准 STL 使用 RB-tree 为底层机制 ⇒ 自动排序(关于键值): ...
- 【47.95%】【codeforces 554C】Kyoya and Colored Balls
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- [Ramda] Convert a Promise.all Result to an Object with Ramda's zip and zipObj
In this lesson, we'll use Promise.all to get an array that contains the resolved values from multipl ...
- Eclipse使用异常——tomcat启动
Eclipse使用异常--tomcat启动 一:问题描写叙述 Eclipse刚上手.非常多地方与Myeclipse不一样的地方.比方tomcat的使用.真心的蛋疼. 环境:JDK7.TOMCAT7.E ...
- 判断navigation中父控制器类型
for (UIViewController *controller in self.navigationController.viewControllers) { if ([controller is ...
- javascript中window对象 部分操作
<!--引用javascript外部脚本--> <script src="ss.js"></script> <script> //警 ...
- zookeeper 分布式安装/配置/启动
版本3.4.10,已提前配置好jdk 三台主机:hadoop002,hadoop003.hadoop004 1.配置 将zookeeper-3.4.10.tar.gz解压后进入zookeeper-3. ...