当前位置:网站首页>C. Fibonacci Words-April Fools Day Contest 2021
C. Fibonacci Words-April Fools Day Contest 2021
2022-06-25 23:33:00 【Qin Sanma】
C. Fibonacci Words
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Input
The input consists of a single string of uppercase letters A-Z. The length of the string is between 1 and 10 characters, inclusive.
Output
Output "YES" or "NO".
Examples
input
Copy
HELP
output
Copy
YES
input
Copy
AID
output
Copy
NO
input
Copy
MARY
output
Copy
NO
input
Copy
ANNA
output
Copy
YES
input
Copy
MUG
output
Copy
YES
input
Copy
CUP
output
Copy
NO
input
Copy
SUM
output
Copy
YES
input
Copy
PRODUCT
output
Copy
NO
==============================================================================
Fools save water , It is worth noting that , Once the two letters exceed 26 This limit , that ascll Will not be able to represent this letter , So we associate it with taking a mold , Judge whether the sum of the modules is equal
#include<iostream>
using namespace std;
int main()
{
string s;
cin>>s;
int flag=0;
int pre1=0,pre2=0;
pre1=s[0]-'A';
pre2=s[1]-'A';
for(int i=2;i<s.length();i++)
{
int now=s[i]-'A';
if((pre1+pre2)%26!=now)
{
flag=1;
break;
}
pre1=pre2;
pre2=now;
}
if(flag)
{
cout<<"no";
}
else
{cout<<"yes"};
return 0;
}
边栏推荐
- Beacon realizes asset management and indoor positioning based on 5.2 ultra-low power Bluetooth module efr32 (bg22ax)
- Meta universe standard forum established
- 首个大众可用PyTorch版AlphaFold2复现,哥大开源OpenFold,star量破千
- STM32 development board + smart cloud aiot+ home monitoring and control system
- 【AXI】解读AXI协议乱序机制
- 【opencv450-samples】读取图像路径列表并保持比例显示
- Problem recording and thinking
- Leaky API interface practical development series (13): gooseneck cloud service php-api two-dimensional array parameter transfer solution
- OpenJudge NOI 2.1 15:Counterfeit Dollar
- C language (I)
猜你喜欢

做接口测试,这3种工具到底什么时候用?

我的vscode

UE4\UE5 蓝图节点Delay与Retriggerable Delay的使用与区别

经典图像分割网络:Unet 支持libtorch部署推理【附代码】

LM small programmable controller software (based on CoDeSys) note XVII: PTO pulse function block
[email protected]@COLLATION_ CONNECTION */"/>. SQL database import error: / *! 40101 SET @OLD_ COLLATION_ [email protected]@COLLATION_ CONNECTION */

qtcreator 格式化代码

Idea auto generator generates constructor get/set methods, etc

hiberate实体类CURD、事务操作汇总

记一次beego通过go get命令后找不到bee.exe的坑
随机推荐
Sword finger offer 46 Translate numbers to strings (DP)
Live800 online customer service system: do business across time and space, starting from each interaction
BI-SQL丨存储过程(一)
The first public available pytorch version alphafold2 is reproduced, and Columbia University is open source openfold, with more than 1000 stars
To solve the incompatibility between VM and device/credential guard, an effective solution for the whole network
UE4_UE5結合offline voice recognition插件做語音識別功能
konva系列教程2:绘制图形
音频基础知识以及PCM转WAV
LeetCode-1528-重新排列字符串-哈希表-字符串
Episode 3: thread synchronization using thread lock
Konva series tutorial 2: drawing graphics
Ue4 Ue5 combine le plug - in de reconnaissance vocale de bureau pour la reconnaissance vocale
我的vscode
Windows安装Redis及简单使用
UE4\UE5 蓝图节点Delay与Retriggerable Delay的使用与区别
UE4 学习记录二 给角色添加骨架,皮肤,及运动动画
Idea auto generator generates constructor get/set methods, etc
OBS-Studio-27.2.4-Full-Installer-x64. Exe Download
Circuit module analysis exercise 5 (power supply)
How to use drawing comparison function in CAD