字符串
shishiness
这个作者很懒,什么都没留下…
展开
-
2020年7月pat甲级 第一题
题意:给一个数(比如20190301),每次去除最前面的一个数字,判断去除该数字之后的数 是不是素数。#include<iostream>using namespace std;bool isprime(int n){ if(n<=1) return false; for(int i=2;i*i<=n;i++){ if(n%i==0) return false; } return true;} int main(){ string s; cin>.原创 2020-07-26 09:55:55 · 133 阅读 · 0 评论 -
pat 甲级 数字处理 A1069 The Black Hole of Numbers (20分)
1069 The Black Hole of Numbers (20分)For any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing order first, and then in non-decreasing order, a new number can be obtained by taking the second nu...原创 2020-08-27 20:06:36 · 94 阅读 · 0 评论 -
pat 甲级 数字处理 A1108 Finding Average (20分)(判断小数点位数!!!
1108 Finding Average (20分)The basic task is simple: given N real numbers, you are supposed to calculate their average. But what makes it complicated is that some of the input numbers might not be legal. A legal input is a real number in [−1000,1000] and原创 2020-08-25 23:05:11 · 85 阅读 · 0 评论 -
pat 甲级 字符串 A1112 Stucked Keyboard (20分)
1112 Stucked Keyboard (20分)On a broken keyboard, some of the keys are always stucked. So when you type some sentences, the characters corresponding to those keys will appear repeatedly on screen for k times.Now given a resulting string on screen, you a原创 2020-07-23 18:15:33 · 75 阅读 · 0 评论 -
pat 甲级 字符串 A1071 Speech Patterns (25分)(map
1071 Speech Patterns (25分)People often have a preference among synonyms of the same word. For example, some may prefer "the police", while others may prefer "the cops". Analyzing such patterns can help to narrow down a speaker's identity, which is useful原创 2020-08-27 20:07:38 · 69 阅读 · 0 评论 -
pat 甲级 字符串 A1061 Dating (20分)
1061 Dating (20分)Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm. It took him only a minute to figure out that those strange strings are actually referring to the coded原创 2020-08-28 19:09:38 · 373 阅读 · 0 评论 -
pat 甲级 字符串 A1077 Kuchiguse (20分)
1077 Kuchiguse (20分)The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker's personality. Such a preference is called "Kuchiguse" and is often exagge...原创 2020-08-28 19:09:17 · 130 阅读 · 0 评论 -
pat 甲级 字符串 A1035 Password (20分)
1035 Password (20分)To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (one) from l (L in lowercase), or 0 (zero) from O (原创 2020-08-28 19:09:47 · 59 阅读 · 0 评论 -
pat 甲级 字符串 A1005 Spell It Right (20分)
1005 Spell It Right (20分)Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input file contains one test case. Each case occupies one line whic原创 2020-08-28 19:09:56 · 70 阅读 · 0 评论 -
pat 甲级 A1120 Friend Numbers (20分)
1120 Friend Numbers (20分)Two integers are called "friend numbers" if they share the same sum of their digits, and the sum is their "friend ID". For example, 123 and 51 are friend numbers since 1+2+3 = 5+1 = 6, and 6 is their friend ID. Given some numbers原创 2020-07-22 10:52:53 · 84 阅读 · 0 评论 -
pat 甲级 字符串 A1140 Look-and-say Sequence (20分)
1140 Look-and-say Sequence (20分)Look-and-say sequence is a sequence of integers as the following:D, D1, D111, D113, D11231, D112213111, ...where D is in [0, 9] except 1. The (n+1)st number is a kind of description of the nth number. For example, th原创 2020-07-22 10:13:17 · 75 阅读 · 0 评论