当前位置:网站首页>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; }
边栏推荐
- It's OK to have hands-on 8 - project construction details 3-jenkins' parametric construction
- 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.
- 功能:求出菲波那契数列的前一项与后一项之比的极限的 近似值。例如:当误差为0.0001时,函数值为0.618056。
- The culprit of unrestrained consumption -- Summary
- 不得不会的Oracle数据库知识点(二)
- [common error] custom IP instantiation error
- Five high-frequency questions were selected from the 200 questions raised by 3000 test engineers
- Stock price forecast
- [complimentary ppt] kubemeet Chengdu review: make the delivery and management of cloud native applications easier!
- 数据库表外键的设计
猜你喜欢

STM32 GPIO CSDN creative punch in

手机异步发送短信验证码解决方案-Celery+redis
![[C language] break and continue in switch statement](/img/ae/5967fefcf3262c9d3096e5c7d644fd.jpg)
[C language] break and continue in switch statement

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

Release and visualization of related data
![[CSDN Q & A] experience and suggestions](/img/db/dff3173dda24ca5740729b54a81153.jpg)
[CSDN Q & A] experience and suggestions

Data mining vs Machine Learning: what is the difference between them? Which is more suitable for you to learn

How to use AHAS to ensure the stability of Web services?
![CesiumJS 2022^ 源码解读[8] - 资源封装与多线程](/img/d2/99932660298b4a4cddd7e5e69faca1.png)
CesiumJS 2022^ 源码解读[8] - 资源封装与多线程

功能:求5行5列矩阵的主、副对角线上元素之和。注意, 两条对角线相交的元素只加一次。例如:主函数中给出的矩阵的两条对角线的和为45。
随机推荐
Celebrate the new year | Suihua fire rescue detachment has wonderful cultural activities during the Spring Festival
Software testers, how can you quickly improve your testing skills? Ten minutes to teach you
It is worthy of "Alibaba internal software test interview notes" from beginning to end, all of which are essence
Analysis: misunderstanding of choosing WMS warehouse management system
Joint examination of six provinces 2017
[dynamic programming] leetcode 53: maximum subarray sum
Qtcharts notes (V) scatter diagram qscatterseries
Cannot build artifact 'test Web: War expanded' because it is included into a circular depend solution
From functools import reduce -- see the use of reduce function from typical examples
网上的低佣金链接安全吗?招商证券怎么开户?
Speed up the energy Internet of things. What can low-power Internet of things technology represented by Zeta do?
基于.NetCore开发博客项目 StarBlog - (14) 实现主题切换功能
[GNN] hard core! This paper combs the classical graph network model
国元证券开户是真的安全可靠吗
Delete all elements with a value of Y. The values of array elements and y are entered by the main function through the keyboard.
The culprit of unrestrained consumption -- Summary
HR disgusted interview behavior
PMP 考试常见工具与技术点总结
Employees' turnover intention is under the control of the company. After the dispute, the monitoring system developer quietly removed the relevant services
CesiumJS 2022^ 源码解读[8] - 资源封装与多线程