当前位置:网站首页>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; }
边栏推荐
- Employees' turnover intention is under the control of the company. After the dispute, the monitoring system developer quietly removed the relevant services
- The FISCO bcos console calls the contract and reports an error does not exist
- NLP pre training technology development
- [PHP basics] cookie basics, application case code and attack and defense
- Regular expression of shell script value
- Eight year test old bird, some suggestions for 1-3 year programmers
- 【leetcode】374. Guess the size of the number
- Axure resources and prototype tool Axure RP 9 download
- 删除所有值为y的元素。数组元素中的值和y的值由主函数通过键盘输入。
- swagger中响应参数为Boolean或是integer如何设置响应描述信息
猜你喜欢
![[complimentary ppt] kubemeet Chengdu review: make the delivery and management of cloud native applications easier!](/img/28/fc05f2e8d53cf81fd061c799090022.jpg)
[complimentary ppt] kubemeet Chengdu review: make the delivery and management of cloud native applications easier!

机器学习基础:用 Lasso 做特征选择

Unity elementary case notes of angry birds Siki college 1-6

The FISCO bcos console calls the contract and reports an error does not exist

Is it really possible that the monthly salary is 3K and the monthly salary is 15K?

It's OK to have hands-on 8 - project construction details 3-jenkins' parametric construction

The difference between objects and objects

Regular expression of shell script value

Beijing invites reporters and media

Struct in linked list
随机推荐
Employees' turnover intention is under the control of the company. After the dispute, the monitoring system developer quietly removed the relevant services
gslb(global server load balance)技术的一点理解
我管你什么okr还是kpi,PPT轻松交给你
Severity code description the project file line prohibits the display of status error c4996 fopen ('fscanf ', StrCmp): this function or variable may be unsafe The most comprehensive solution
MySQL winter vacation self-study 2022 12 (1)
[prefix and notes] prefix and introduction and use
老姜的特点
It's OK to have hands-on 8 - project construction details 3-jenkins' parametric construction
MySQL is installed as a Windows Service
Weekly open source project recommendation plan
8. Go implementation of string conversion integer (ATOI) and leetcode
不得不会的Oracle数据库知识点(一)
For loop
swagger中响应参数为Boolean或是integer如何设置响应描述信息
[common error] custom IP instantiation error
Anomalies seen during the interview
功能:将主函数中输入的字符串反序存放。例如:输入字符串“abcdefg”,则应输出“gfedcba”。
ESP Arduino playing with peripherals (V) basic concept of interrupt and timer interrupt
AI Challenger 2018 text mining competition related solutions and code summary
不得不会的Oracle数据库知识点(二)