当前位置:网站首页>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; }
边栏推荐
- 不得不会的Oracle数据库知识点(一)
- 网上的低佣金链接安全吗?招商证券怎么开户?
- 2-redis architecture design to use scenarios - four deployment and operation modes (Part 2)
- Data mining vs Machine Learning: what is the difference between them? Which is more suitable for you to learn
- It's OK to have hands-on 8 - project construction details 3-jenkins' parametric construction
- CSP window
- [complimentary ppt] kubemeet Chengdu review: make the delivery and management of cloud native applications easier!
- 关于 uintptr_t和intptr_t 类型
- Bodong medical sprint Hong Kong stocks: a 9-month loss of 200million Hillhouse and Philips are shareholders
- Regular expression of shell script value
猜你喜欢
![[error record] configure NDK header file path in Visual Studio (three header file paths of NDK | ASM header file path selection related to CPU architecture)](/img/44/aa4963d07d046deb2bc76eb59f8ff7.jpg)
[error record] configure NDK header file path in Visual Studio (three header file paths of NDK | ASM header file path selection related to CPU architecture)
![[PHP basics] cookie basics, application case code and attack and defense](/img/7c/551b79fd5dd8a411de85c800c3a034.jpg)
[PHP basics] cookie basics, application case code and attack and defense

功能:求出菲波那契数列的前一项与后一项之比的极限的 近似值。例如:当误差为0.0001时,函数值为0.618056。
![[cloud native topic -48]:kubesphere cloud Governance - operation - overview of multi tenant concept](/img/b4/961b3b44e9ecbfd4bddd04318b663a.jpg)
[cloud native topic -48]:kubesphere cloud Governance - operation - overview of multi tenant concept

Sorry, Tencent I also refused

Sequence list and linked list

Collation of the most complete Chinese naturallanguageprocessing data sets, platforms and tools

Function: find the approximate value of the limit of the ratio of the former term to the latter term of Fibonacci sequence. For example, when the error is 0.0001, the function value is 0.618056.

Reading notes on how programs run

A method to solve Bert long text matching
随机推荐
(Introduction to database system | Wang Shan) Chapter V database integrity: Exercises
The culprit of unrestrained consumption -- Summary
What insurance products should be bought for the elderly?
功能:求5行5列矩阵的主、副对角线上元素之和。注意, 两条对角线相交的元素只加一次。例如:主函数中给出的矩阵的两条对角线的和为45。
Regular expression of shell script value
网上的低佣金链接安全吗?招商证券怎么开户?
Att & CK actual combat series - red team actual combat - V
The first training of wechat applet
URL (data:image/png; Base64, ivborw0k... Use case
Global and Chinese market of melting furnaces 2022-2028: Research Report on technology, participants, trends, market size and share
Unity elementary case notes of angry birds Siki college 1-6
The super fully automated test learning materials sorted out after a long talk with a Tencent eight year old test all night! (full of dry goods
机器学习基础:用 Lasso 做特征选择
关于 uintptr_t和intptr_t 类型
删除所有值为y的元素。数组元素中的值和y的值由主函数通过键盘输入。
[C language] break and continue in switch statement
Collation of the most complete Chinese naturallanguageprocessing data sets, platforms and tools
Reading notes on how programs run
OS interrupt mechanism and interrupt handler
【leetcode】374. Guess the size of the number