当前位置:网站首页>All in one 1407: stupid monkey
All in one 1407: stupid monkey
2022-07-04 00:42:00 【Studying hard】
【 Title Description 】
Stupid little monkey has a small vocabulary , So every time I do multiple choice questions, I have a headache . But he found a way , It has been proved that , It's a very good way to choose the right option !
The specific description of this method is as follows : hypothesis maxnmaxn It's the number of letters that appear most frequently in a word ,minnminn It's the number of letters that appear the least in a word , If maxn−minnmaxn−minn It's a prime number , So stupid little monkey thinks it's a Lucky WordLucky Word, Such a word is probably the right answer .
【 Input 】
There is only one line , It's a word , Only lowercase letters are possible , And the length is less than 100100.
【 Output 】
There are two lines , The first line is a string , Suppose the input word is Lucky WordLucky Word, Then output “Lucky WordLucky Word”, Otherwise output “No AnswerNo Answer”;
The second line is an integer , If the input word is Lucky WordLucky Word, Output maxn−minnmaxn−minn Value , Otherwise output 00.
【 sample input 】
error【 sample output 】
Lucky Word 2【 Tips 】
The sample input :
Examples #2:
olympicSample output :
Examples #2:
No Answer 0#include<stdio.h> #include<string.h> int main() { char s[120]; scanf("%s", s); int len = strlen(s); int i; int a; int b[150] = { 0 }; for (i = 0; i < len; i++) { a = s[i]; b[a]++; } int max=0; int min=101; for (i = 0; i < 150; i++) { if (b[i] != 0) { if (max < b[i]) max = b[i]; if (min > b[i]) min = b[i]; } } int num = max - min; if (num < 2) { printf("No Answer\n"); printf("0"); } if (num >= 2) { for (i = 2; i <= num; i++) { if (num % i == 0) { break; } } if (num == i) { printf("Lucky Word\n"); printf("%d", num); } else { printf("No Answer\n"); printf("0"); } } return 0; }
边栏推荐
- [common error] custom IP instantiation error
- Is the low commission link on the internet safe? How to open an account for China Merchants Securities?
- Software testers, how can you quickly improve your testing skills? Ten minutes to teach you
- Stock price forecast
- Suggestions for improving code quality
- From functools import reduce -- see the use of reduce function from typical examples
- 挖财帮个人开的证券账户安全吗?是不是有套路
- 国元证券开户是真的安全可靠吗
- Release and visualization of related data
- The culprit of unrestrained consumption -- Summary
猜你喜欢

手机异步发送短信验证码解决方案-Celery+redis

查询效率提升10倍!3种优化方案,帮你解决MySQL深分页问题
![[about text classification trick] things you don't know](/img/c0/fdb04f6b31f1dba2658c2430dc4036.jpg)
[about text classification trick] things you don't know

功能:编写函数fun求s=1^k+2^k +3^k + ......+N^k的值, (1的K次方到N的K次方的累加和)。

Network layer - routing

GUI 应用:socket 网络聊天室

BBS forum recommendation

2-Redis架构设计到使用场景-四种部署运行模式(下)

MySQL is installed as a Windows Service

Beijing invites reporters and media
随机推荐
gslb(global server load balance)技术的一点理解
Introduction to thread pool
From functional testing to automated testing, how did I successfully transform my salary to 15K +?
Anomalies seen during the interview
MySQL 8.0.12 error: error 2013 (HY000): lost connection to MySQL server during query
Analysis: misunderstanding of choosing WMS warehouse management system
Sorry, Tencent I also refused
AI Challenger 2018 text mining competition related solutions and code summary
swagger中响应参数为Boolean或是integer如何设置响应描述信息
Windos10 reinstallation system tutorial
[cloud native topic -48]:kubesphere cloud Governance - operation - overview of multi tenant concept
Regular expressions and text processors for shell programming
Global and Chinese markets for blood and liquid heating devices 2022-2028: Research Report on technology, participants, trends, market size and share
How to trade spot gold safely?
1-Redis架构设计到使用场景-四种部署运行模式(上)
Unity Shader入门精要读书笔记 第三章 Unity Shader基础
Release and visualization of related data
Eight year test old bird, some suggestions for 1-3 year programmers
ESP Arduino playing with peripherals (V) basic concept of interrupt and timer interrupt
Is the low commission link on the internet safe? How to open an account for China Merchants Securities?