- 博客(127)
- 收藏
- 关注
原创 ALi-2020/3/27-1
题目:给定两个字符串S、T,保证0<|S|=|T|<100000;即长度相等,先输入S、后输入T,若S经过变换可以变为T,则输出对应的变换次数,若不行,则输出-1。变换是指把某个字母放到字符串的末尾。串由小写字母组成。例子: 输入: acdk ckad 输出: 2说明:第一步把a提到末尾,第二步把d提到末尾。思路:是否可以...
2020-03-27 11:02:14
303
原创 CCF——2015/12——第一题——数位之和(100分)
试题编号: 201512-1 试题名称: 数位之和 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述 给定一个十进制整数n,输出n的各位数字之和。 输入格式 输入一个整数n。 输出格式 输出一个整数,表示答案。 样例输入 20151220 样例输出...
2020-03-27 00:42:17
300
原创 CCF——2013/12——第一题——出现次数最多的数(100分)
100分#include <iostream>#include <cmath>#include <algorithm>using namespace std;const int MAXN = 1e4+10;const int MINN = -10;int a[MAXN]; int main(void){ for(int i=0; ...
2020-02-10 23:20:40
364
1
原创 CCF——2019/12/15——第五题——魔数(10分)
题目链接/*10分....*/#include <iostream>#include <algorithm>#include <cstring>#include <cmath>using namespace std;const int M = 1e5;int a[M];int f(int x){ return x ...
2019-12-18 19:30:47
1043
4
原创 CCF——2019/12/15——第三题——化学方程式(30分)
/*30分....*/#include <iostream>#include <algorithm>#include <cstring>#include <cmath>using namespace std;const int M = 53;int a[M];//等号前面的各元素个数 int b[M];//等号后面的各元素个...
2019-12-18 19:29:54
507
原创 CCF——2019/12/15——第二题——回收站选址(100分)
#include <iostream>#include <algorithm>#include <cstring>#include <cmath>using namespace std;const int M = 6;const int MAX=1006;int a[M];//存放每个得分的选址个数 struct Node{...
2019-12-18 19:28:46
392
1
原创 CCF——2019/12/15——第一题——报数(100分)
#include <iostream>#include <algorithm>#include <cstring>#include <cmath>using namespace std;const int M = 4;int a[M+1];bool function(int i){ int a; while(i){ a...
2019-12-18 19:28:08
523
原创 HDU-1425 sort
sort Time Limit: 6000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 76053Accepted Submission(s): 19980 Problem Description 给你n个整数,请按...
2019-11-07 17:51:02
183
原创 Openacc优化矩阵乘法
#include <iostream>#include <cstdlib>#include <chrono>#define N 1000//可以更改大小using namespace std;using namespace std::chrono;double a[N][N], b[N][N], c[N][N];int main(){...
2019-09-28 14:05:53
983
1
原创 常见模板
1、闰年#include <iostream>using namespace std;//计算闰年数int leapyear(int year){ return((year%4==0)&&(year%100!=0)) || (year%400==0) ? 1 : 0;} int main(void){ int n; cin >>...
2019-09-24 22:43:48
179
原创 CCF——2019/09——第二题——小明种苹果(续)(50分)
50分#include <iostream>#include <algorithm>#include <cmath>#include <cstring>#include <cstdio>using namespace std;const int N = 1e4+10;int a[N];int b[N];//标记数...
2019-09-22 21:18:08
290
原创 CCF——2019/09——第一题——小明种苹果(100分)
100分#include <iostream>#include <algorithm>#include <cmath>#include <cstring>#include <cstdio>using namespace std;const int N = 1e4+10;int a[N][N];int b[N];/...
2019-09-22 21:17:28
299
原创 Backward Digit Sums POJ - 3187
FJ and his cows enjoy playing a mental game. They write down the numbers from 1 to N (1 <= N <= 10) in a certain order and then sum adjacent numbers to produce a new list with one fewer number. ...
2019-08-28 00:18:58
152
原创 Smallest Difference POJ - 2718
Given a number of distinct decimal digits, you can form one integer by choosing a non-empty subset of these digits and writing them in some order. The remaining digits can be written down in some orde...
2019-08-27 21:35:16
178
原创 CodeForce Tic-Tac-Toe
Two bears are playing tic-tac-toe via mail. It's boring for them to play usual tic-tac-toe game, so they are a playing modified version of this game. Here are its rules.The game is played on the fol...
2019-08-25 21:34:00
338
原创 2019CCPC网络赛——1003——K-th occurrence
K-th occurrenceTime Limit: 5000/5000 MS (Java/Others)Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 0Accepted Submission(s): 0Problem DescriptionYou are given a st...
2019-08-23 22:54:21
923
原创 2019 CCPC网络赛——1007——Windows Of CCPC
Windows Of CCPCTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 0Accepted Submission(s): 0Problem DescriptionIn recent years, CCPC h...
2019-08-23 22:51:16
622
原创 Fence Repair POJ - 3253
Farmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needsN(1 ≤N≤ 20,000) planks of wood, each having some integer lengthLi(1 ≤Li...
2019-08-15 19:48:19
146
原创 Saruman's Army POJ - 3069
ithinRunits of some palantir.InputThe input test file will contain multiple cases. Each test case begins with a single line containing an integerR, the maximum effective range of all palantirs ...
2019-08-15 18:43:19
145
原创 Meteor Shower POJ - 3669
Bessie hears that an extraordinary meteor shower is coming; reports say that these meteors will crash into earth and destroy anything they hit. Anxious for her safety, she vows to find her way to a sa...
2019-08-10 15:30:26
217
原创 Cheese Aizu-0558(BFS)
チーズ ()問題今年も JOI 町のチーズ工場がチーズの生産を始め,ねずみが巣から顔を出した.JOI 町は東西南北に区画整理されていて,各区画は巣,チーズ工場,障害物,空き地のいずれかである.ねずみは巣から出発して全てのチーズ工場を訪れチーズを 1 個ずつ食べる.この町には,N 個のチーズ工場があり,どの工場も1種類のチーズだけを生産している.チーズの硬さは工場によって異なっており,硬...
2019-08-09 22:32:27
264
原创 Ball Aizu - 0033
玉図のように二股に分かれている容器があります。1 から 10 までの番号が付けられた10 個の玉を容器の開口部 A から落とし、左の筒 B か右の筒 C に玉を入れます。板 D は支点 E を中心に左右に回転できるので、板 D を動かすことで筒 B と筒 C のどちらに入れるか決めることができます。開口部 A から落とす玉の並びを与えます。それらを順番に筒 B 又は筒 Cに入れて...
2019-08-09 00:07:01
250
原创 Property Distribution Aizu - 0118
タナカ氏がHWアールの果樹園を残して亡くなりました.果樹園は東西南北方向にH×Wの区画に分けられ、区画ごとにリンゴ、カキ、ミカンが植えられています.タナカ氏はこんな遺言を残していました.果樹園は区画単位でできるだけ多くの血縁者に分けること.ただし、ある区画の東西南北どれかの方向にとなりあう区画に同じ種類の果物が植えられていた場合は、区画の境界が分からないのでそれらは1つの大きな区画として扱うこ...
2019-08-08 14:14:11
173
原创 Red and Black POJ - 1979
There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he c...
2019-08-08 13:17:20
229
原创 Lake Counting POJ - 2386
Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 100) squares. Each square contains...
2019-08-07 23:31:07
104
原创 栈、队列常见用法总结(持续更新中。。。)
1、栈//栈 #include <iostream>#include <stack>using namespace std;int main(void){ stack<int> s; //声明存储int类型数据的栈 s.push(1); //{} -> {1} s.push(2); ...
2019-08-06 22:28:46
208
原创 常用的递归函数模板总结
1、n的阶乘//递归形式的n的阶乘 n! = n * (n-1)! int fact(int n){ if(n == 0){//这就是函数的停止条件 return 1; } return n * fact(n-1);}//编写递归函数时,函数的停止条件是必须存在的 //否则函数就会无限地递归下去2、斐波那契数列//斐波那契数列a0 = 0、a1 = ...
2019-08-06 18:02:19
1295
原创 Ants POJ - 1852
题目:一队蚂蚁在一根水平杆上行走,每只蚂蚁固定速度 1cm/s. 当一只蚂蚁走到杆的尽头时,立即从秆上掉落. 当两只蚂蚁相遇时它们会掉头向相反的方向前进. 我们知道每只蚂蚁在杆上的初始位置, 但是, 我们不知道蚂蚁向哪个方向前行. 你的任务是计算所有蚂蚁都杆上掉落可能的最短时间和最长时间.Input第一行包含一个整数,给出测试实例数量. 每组数据开始有两个整数: 杆的长度 (单位:...
2019-08-05 18:31:15
259
原创 CodeForce Proper Nutrition
Vasya hasnburles. One bottle of Ber-Cola costsaburles and one Bars bar costsbburles. He can buy any non-negative integer number of bottles of Ber-Cola and any non-negative integer number of Bars ...
2019-08-04 22:04:21
130
原创 CodeForce Rounding
Vasya has a non-negative integern. He wants to round it to nearest integer, which ends up with0. Ifnalready ends up with0, Vasya considers it already rounded.For example, ifn = 4722answer is...
2019-08-04 21:41:56
158
原创 KuangBin——简单搜索——Oil Deposits HDU - 1241
The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a grid that divides th...
2019-08-02 18:57:53
156
原创 The 2018 ACM-ICPC Chinese Collegiate Programming Contest(Ningxia)题解
A题——Maximum Element In A Stack C - Caesar Cipher
2019-07-13 14:46:15
247
原创 The 2018 ACM-ICPC Chinese Collegiate Programming Contest(Ningxia)——C - Caesar Cipher
In cryptography, a Caesar cipher, also known as the shift cipher, is one of the most straightforward and most widely known encryption techniques. It is a type of substitution cipher in which each l...
2019-07-13 14:34:45
406
原创 输出GPLT
L1-023输出GPLT(20分)给定一个长度不超过10000的、仅由英文字母构成的字符串。请将字符重新调整顺序,按GPLTGPLT....这样的顺序输出,并忽略其它字符。当然,四种字符(不区分大小写)的个数不一定是一样多的,若某种字符已经输出完,则余下的字符仍按GPLT的顺序打印,直到所有字符都被输出。输入格式:输入在一行中给出一个长度不超过10000的、仅由英文字母构成的非空...
2019-03-29 22:11:33
197
2
原创 查验身份证
L1-016查验身份证(15分)一个合法的身份证号码由17位地区、日期编号和顺序编号加1位校验码组成。校验码的计算规则如下:首先对前17位数字加权求和,权重分配为:{7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};然后将计算的和对11取模得到值Z;最后按照以下关系对应Z值与校验码M的值:Z:0 1 2 3 4 5 6 7 8 9 10M:1 0 X ...
2019-03-29 19:59:32
920
原创 跟奥巴马一起画方块
L1-015跟奥巴马一起画方块(15分)美国总统奥巴马不仅呼吁所有人都学习编程,甚至以身作则编写代码,成为美国历史上首位编写计算机代码的总统。2014年底,为庆祝“计算机科学教育周”正式启动,奥巴马编写了很简单的计算机代码:在屏幕上画一个正方形。现在你也跟他一起画吧!输入格式:输入在一行中给出正方形边长N(3≤N≤21)和组成正方形边的某种字符C,间隔一个空格。输出格式:...
2019-03-29 10:05:14
669
1
原创 计算阶乘和
L1-013计算阶乘和(10分)对于给定的正整数N,需要你计算S=1!+2!+3!+...+N!。输入格式:输入在一行中给出一个不超过10的正整数N。输出格式:在一行中输出S的值。输入样例:3输出样例:9#include <iostream>#include <string.h>#include <cs...
2019-03-29 09:45:31
451
原创 A-B
L1-011A-B(20分)本题要求你计算A−B。不过麻烦的是,A和B都是字符串 —— 即从字符串A中把字符串B所包含的字符全删掉,剩下的字符组成的就是字符串A−B。输入格式:输入在2行中先后给出字符串A和B。两字符串的长度都不超过104,并且保证每个字符串都是由可见的ASCII码和空白字符组成,最后以换行符结束。输出格式:在一行中打印出A−B的结果字符串。输入...
2019-03-29 09:34:50
346
原创 求整数段和
L1-008求整数段和(10分)给定两个整数A和B,输出从A到B的所有整数以及这些数的和。输入格式:输入在一行中给出2个整数A和B,其中−100≤A≤B≤100,其间以空格分隔。输出格式:首先顺序输出从A到B的所有整数,每5个数字占一行,每个数字占5个字符宽度,向右对齐。最后在一行中按Sum = X的格式输出全部数字的和X。输入样例:-3 8输出样例:...
2019-03-28 20:25:45
288
原创 念数字
L1-007念数字(10分)输入一个整数,输出每个数字对应的拼音。当整数为负数时,先输出fu字。十个数字对应的拼音如下:0: ling1: yi2: er3: san4: si5: wu6: liu7: qi8: ba9: jiu输入格式:输入在一行中给出一个整数,如:1234。提示:整数包括负数、零和正数。输出格式:在一行中输出这个整数对应...
2019-03-28 19:38:13
358
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人