水题
水题
Suprit
先选择一种经历,经历再造就一个人
展开
-
【题解】牛客 114514⭐⭐ 【水题】
牛客 114514给你一个长为n的序列定义一个序列下标的子集为先辈,当且仅当选出的这些下标对应的序列值的乘积为114514,而且因为只有一只野兽,所以有个要求是选出来的这些下标所对应的序列值最多有一个1请输出有多少先辈Input来源:牛客网第一行一个数表示n之后一行n个数表示这个序列n <= 229028,序列的值域在[0,1145141919]中Output输出一行一个...原创 2019-09-22 11:19:08 · 1490 阅读 · 2 评论 -
A. Ilya and a Colorful Walk (水题)
A. Ilya and a Colorful WalkIlya lives in a beautiful city of Chordalsk.There are n houses on the street Ilya lives, they are numerated from 1 to n from left to right; the distance between every two...原创 2019-04-08 10:12:05 · 406 阅读 · 0 评论 -
The 3n + 1 problem UVA - 100 (细节)
The 3n + 1 problem UVA - 100题意:给出n, n为偶数则n = n/2, 奇数则n = n*3+1, 直至n==1题解:经典的3N+1问题, 主要要写循环不要写递归, 否则会爆, 以及换行的格式问题#include <cstdio>#include <iostream>#include <algorithm>#in...原创 2019-03-17 22:00:03 · 612 阅读 · 0 评论 -
PAT 有假币 (递推 难度2) - 详细题解
看着就像递推, 但这题的递推并不能用数组来表示, 因为会越界递推的三种写法 1. 数组 2.滚动数组 3.递归递推的一般思路 1. 枚举几组数 2.找题中的内在联系.这题还是比较复杂的一个递推题目, 首先仔细理解题意, 可以想到每次把钱分成三组应该是最优的一种策略因为无论当前比较的两组是平还是不平, 都可以一下子排除3/2的数据ps: 平了, 则假币一定在没称的那组里; 不...原创 2018-11-19 22:14:01 · 648 阅读 · 5 评论 -
PAT 星际密码 (递推 + 找规律) - 详细题解
通过这道题我发现PAT的一个规律, 就是题比较难读懂, 而题本身并不难比如这道题吧, 我把程序都写对了, 还是没能读懂题意看到89我就知道这是一个斐波那契数列, 因为只取后四位所以要%10000//星际密码#include <cstdio>#include <iostream>#include <algorithm>#include &...原创 2018-11-13 21:16:01 · 779 阅读 · 0 评论 -
PAT 蜜蜂寻路 (递推) - 详细题解
这道题非常巧妙, 仔细理解一下行走的逻辑, 发现递推公式其实就是一个斐波那契数列但是由于数据过大, 仅仅开int也开不了2^31那么多的数组, 在这里有两种思路1. 在上网看的, 因为数据范围只有2^63, 其实开到102就足矣了2. 我使用的, 用一个滚动数组来递推就好了//蜜蜂寻路#include <cstdio>#include <iostream...原创 2018-11-12 17:51:20 · 503 阅读 · 0 评论 -
逆波兰表达式 OpenJ_Bailian - 2694
逆波兰表达式本来应该是后缀和,在这里题中把它改为前缀和了,有两种计算方式。一种是从后往前,是运算符就出栈两个数计算,是数就直接入栈。一种是从前往后,是运算符就递归一次计算,直到全部计算完毕//逆波兰表达式#include<bits/stdc++.h>using namespace std;double solve(){ char input[20]; ...原创 2018-09-10 19:21:20 · 328 阅读 · 0 评论 -
2:2的幂次方表示(递归)
没什么好说的。实在试不出来多试试就行了。注意对+的处理//2的幂次方表示#include<bits/stdc++.h>using namespace std;int n;void Dfs(int n){ if(n > 4){ int t = 1; while((1<<t) <= n) ++t; ...原创 2018-09-11 17:04:47 · 2197 阅读 · 0 评论 -
PAT 1052 卖个萌 (字符串 难度2) - 详细题解
题本身并不是很难, 只是其中涉及的知识, 如果学习时候不细心的话…还真不一定知道比如题上的这些特殊字符, 不能够用一个char来存, 必须用char数组或者是string来存主要就是输入有点麻烦, 但语言用熟练的话也就好了#include &lt;cstdio&gt;#include &lt;iostream&gt;#include &lt;algorithm&gt;#include...原创 2018-12-05 19:28:10 · 407 阅读 · 0 评论 -
Restoring Three Numbers CodeForces - 1154A
Restoring Three Numbers CodeForces - 1154A Polycarp has guessed three positive integers a, b and c. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — ...原创 2019-04-18 18:17:23 · 657 阅读 · 0 评论 -
【题解】Reverse a Substring CodeForces - 1155A(水题)⭐
【题解】Reverse a Substring CodeForces - 1155A(水题)⭐⭐⭐You are given a string s consisting of n lowercase Latin letters.Let’s define a substring as a contiguous subsegment of a string. For example, “acab”...原创 2019-04-23 16:06:32 · 759 阅读 · 1 评论 -
ZZULIOJ 2309: Gene mutation (水题)
2309: Gene mutationGene mutation is the sudden and inheritable mutation of genomic DNA molecules. From the molecular level, gene mutation refers to the change of the composition or sequence of base p...原创 2019-04-19 17:12:18 · 316 阅读 · 0 评论 -
2019携程面试题 车辆时刻分组表 (map)
#include<bits/stdc++.h>using namespace std;string s;map<char, int> ma, cnt;vector<int> ans;bool judge(){ for(auto it:ma) if(it.second != cnt[it.first]) ...原创 2019-09-04 20:35:00 · 463 阅读 · 3 评论 -
【题解】HDU6668 Polynomial⭐【水题】
HDU6668 Polynomial度度熊最近学习了多项式和极限的概念。现在他有两个多项式 f(x) 和 g(x),他想知道当 x 趋近无限大的时候,f(x)/g(x) 收敛于多少。Input第一行一个整数 T (1≤T≤100) 表示数据组数。对于每组数据,第一行一个整数 n (1≤n≤1,000),n−1 表示多项式 f 和 g 可能的最高项的次数(最高项系数不一定非0)。接下来一...原创 2019-08-20 09:54:53 · 216 阅读 · 0 评论 -
【题解】codeforce1206 A. Choose Two Numbers⭐【水题】
codeforce1206 A. Choose Two NumbersYou are given an array A, consisting of n positive integers a1,a2,…,an, and an array B, consisting of m positive integers b1,b2,…,bm.Choose some element a of A and...原创 2019-08-19 19:59:35 · 406 阅读 · 0 评论 -
【题解】codeforce1197 A. DIY Wooden Ladder⭐ 【水题】
codeforce1197 A. DIY Wooden LadderLet’s denote a k-step ladder as the following structure: exactly k+2 wooden planks, of whichtwo planks of length at least k+1 — the base of the ladder;k planks of ...原创 2019-07-23 10:58:40 · 229 阅读 · 0 评论 -
【题解】codeforce1199 A. City Day⭐ 【水题】
codeforce1199 A. City Day⭐ For years, the Day of city N was held in the most rainy day of summer. New mayor decided to break this tradition and select a not-so-rainy day for the celebration. The mayo...原创 2019-08-04 15:03:32 · 396 阅读 · 0 评论 -
【题解】A. Chunga-Changa⭐ 【水题】
A. Chunga-Changa⭐Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called “chizhik”. One...原创 2019-06-17 22:14:39 · 318 阅读 · 0 评论 -
【题解】A. Filling Shapes⭐ 【水题】
A. Filling ShapesYou have a given integer n. Find the number of ways to fill all 3×n tiles with the shape described in the picture below. Upon filling, no empty spaces are allowed. Shapes cannot over...原创 2019-06-12 21:39:20 · 504 阅读 · 0 评论 -
【题解】A. Telephone Number⭐ 【水题】
A. Telephone NumberA telephone number is a sequence of exactly 11 digits, where the first digit is 8. For example, the sequence 80011223388 is a telephone number, but the sequences 70011223388 and 80...原创 2019-05-17 11:11:39 · 592 阅读 · 0 评论 -
codeforces 1133A. Middle of the Contest(水题)
Polycarp is going to participate in the contest. It starts at h1:m1 and ends at h2:m2. It is guaranteed that the contest lasts an even number of minutes (i.e. m1%2=m2%2, where x%y is x modulo y). It...原创 2019-03-10 16:03:24 · 867 阅读 · 0 评论 -
蓝桥杯历届试题 日期问题 (日期处理)
历届试题 日期问题 小明正在整理一批历史文献。这些历史文献中出现了很多日期。小明知道这些日期都在1960年1月1日至2059年12月31日。令小明头疼的是,这些日期采用的格式非常不统一,有采用年/月/日的,有采用月/日/年的,还有采用日/月/年的。更加麻烦的是,年份也都省略了前两位,使得文献上的一个日期,存在很多可能的日期与其对应。比如02/03/04,可能是2002年03月04日、2...原创 2019-03-13 22:04:48 · 1156 阅读 · 0 评论 -
PAT 1152 Google Recruitmen (水题 细心)
PAT 1152 Google RecruitmenIn July 2004, Google posted on a giant billboard along Highway 101 in Silicon Valley (shown in the picture below) for recruitment. The content is super-simple, a URL consist...原创 2019-03-01 11:54:28 · 309 阅读 · 0 评论 -
计蒜客-An Olympian Math Problem(水题)
#include <iostream>#include<cstdio>using namespace std;int a;int main(){ int n; scanf("%d",&n); while(n--){ scanf("%d",&a); int fib[a+5]; fib[1] ...原创 2018-09-02 19:27:07 · 462 阅读 · 2 评论 -
Poj百练 2692:假币问题 (分类:模拟)
//poj2692假币问题#include <iostream>#include<cstdio>#include<string.h>#include<cstdarg>using namespace std;int n;int status[12]; //每个硬币的状态char lef[3][7], righ[3][7], res[...原创 2018-08-06 19:00:20 · 682 阅读 · 0 评论 -
Poj百练 2746:约瑟夫问题 (分类:模拟)
//约瑟夫问题//模拟题要仔细思考清楚基本架构后再上手,不要写着添着改着,很容易逻辑混乱!#include<cstdlib>#include<cstdio>#include<iostream>using namespace std;int flag[305];void init(){ for(int index = 0; index...原创 2018-08-05 21:49:05 · 429 阅读 · 0 评论 -
Poj百练(分类:水题)2701 与7无关的数
水题嘛,还是要刷的,经常刷刷水题,有利于提高自信心,尤其是在初学的时候,毕竟我们也要想得到反馈的嘛! *!这道题中运用到的求位数技巧值得记下。其他的都写在注释里咯~#include<cstdio>#include<iostream>#include <stdlib.h>#include<math.h>using namespac...原创 2018-07-09 16:14:15 · 773 阅读 · 0 评论 -
墙壁涂色问题-计蒜客(递归)
蒜头君觉得白色的墙面好单调,他决定给房间的墙面涂上颜色。他买了 3 种颜料分别是红、黄、蓝,然后把房间的墙壁竖直地划分成 n 个部分,蒜头希望每个相邻的部分颜色不能相同。他想知道一共有多少种给房间上色的方案。例如,当 n = 5时,下面就是一种合法方案。由于墙壁是一个环形,所以下面这个方案就是不合法的。输入格式一个整数 n,表示房间被划分成多少部分。(1≤n≤50)输出...原创 2018-07-24 20:17:06 · 1808 阅读 · 3 评论 -
Poj百练(水题) 2808 校门外的树
仍然是acm的基础题。。简单的数组运算,状态模拟但是伟大往往不都是从菜鸟开始的么哈哈。。本人菜鸟一枚,决心入了acm的坑每周更新poj5-8题,欢迎监督,题是我分好类来刷的,有兴趣的同学可以和我一起。欢迎交流~ 这道题的注意都写在注释里了咯#include<cstdio>#include<iostream>#include<string....原创 2018-06-25 21:58:54 · 720 阅读 · 0 评论 -
Poj百练(水题) 3237 鸡兔同笼
第一章 模拟与计算的思想 基础入手第一刷 鸡兔同笼 重点掌握对信息的状态模拟#include<cstdio>#include<iostream>using namespace std;int n;int main(){ cin >> n; int an[n]; for(int i = 0; i < n; i++) ...原创 2018-06-22 21:36:21 · 624 阅读 · 0 评论 -
Egypt HDU - 4156 (水题)
写这道题时候才发现一件事,原来C++中的 pow 和 sqrt这些函数只能接收浮点类型,不能接收整形。。于是把平方改为了手动乘,看来还是要存一下快速幂的版子#include<iostream>#include<cstdio>#include<algorithm>#include<math.h>using namespace std;...原创 2018-08-27 14:53:51 · 177 阅读 · 0 评论 -
Division UVA - 725 (枚举)
虽然是简单枚举。。但其实题中需要考虑的东西还蛮多的。前几位为0的情况用%05d补齐就行,然后计算0-9各个数的输出次数即可#include<bits/stdc++.h>using namespace std;int cnt[15]; //0-9每个数的出现次数bool judge(int c, int d){ if(d > 98765) return ...原创 2018-09-14 13:41:13 · 220 阅读 · 0 评论 -
金银岛 OpenJ_Bailian - 2795 (贪心)
https://vjudge.net/problem/OpenJ_Bailian-2795贪心水题. 不解释//金银岛 贪心#include<cstdio>#include<algorithm>#include<cstring>using namespace std;const int maxn = 10010;int w, s, k;s...原创 2018-10-11 21:28:32 · 600 阅读 · 0 评论 -
完美字符串 51Nod - 1182 (贪心水题)
https://vjudge.net/problem/51Nod-1182#include<cstdio>#include<iostream>#include <string>#include <cstring>#include<algorithm>using namespace std;string s;str...原创 2018-10-18 18:03:14 · 259 阅读 · 0 评论 -
CF1108A. Two distinct points (水题)
题意: 给出两个区间(可能相交, 重合, 覆盖), 要求找出两个不同的点在两个区间, 特判水题, 直接判读输出即可#include <cstdio>#include <iostream>#include <algorithm>#include <cstring>#include <string>#include <s...原创 2019-01-26 10:52:02 · 530 阅读 · 0 评论 -
PAT 1013 数素数 (筛法求素数 难度1) - 详细题解
题目还是很简单的, 学会用筛法求素数就好了. 先写个demo找到第10000个素数是104729#include <cstdio>#include <iostream>#include <algorithm>#include <cstring>#include <string>#include <stdlib.h>...原创 2018-11-27 15:47:28 · 335 阅读 · 0 评论 -
PAT 1009 说反话 (水题, 难度1) - 详细题解
一道比较基础的字符串问题主要学习一下判断一个空格分隔的字符串是否输入终止其实用while(cin >> str)就可以//利用string对输入单词进行拼接#include <iostream>#include <string>using namespace std;int main(){ string in, out; ...原创 2018-11-24 17:18:21 · 480 阅读 · 1 评论 -
PAT 1005 继续(3n+1)猜想 (水题 难度2) - 详细讲解
我觉得这题可以代表PAT乙级的考核方向, 主要是以题的怪和难理解为主仔细点, 把数组开大点可以避免段错误//继续3n+1猜想#include <cstdio>#include <iostream>#include <algorithm>#include <cstring>#include <string>#inc...原创 2018-11-24 10:44:45 · 394 阅读 · 0 评论 -
PAT NowCoder小定律 (水题) - 详细题解
很水的题, 注意闭区间#include <cstdio>#include <iostream>#include <algorithm>#include <cstring>#include <string>#include <vector>#include <queue>#include &a原创 2018-11-12 20:54:05 · 466 阅读 · 0 评论 -
PAT 养兔子 详细题解 (递推)
https://www.nowcoder.com/pat/2/problem/251很经典的递推问题了#include <cstdio>#include <iostream>#include <algorithm>#include <cstring>#include <string>#include <v...原创 2018-11-08 22:24:58 · 558 阅读 · 0 评论