ALi-2020/3/27-1 题目:给定两个字符串S、T,保证0<|S|=|T|<100000;即长度相等,先输入S、后输入T,若S经过变换可以变为T,则输出对应的变换次数,若不行,则输出-1。变换是指把某个字母放到字符串的末尾。串由小写字母组成。 例子: 输入: acdk ckad 输出: 2 说明:第一步把a提到末尾,第二步把d提到末尾。 思路:是否可以...
CCF——2015/12——第一题——数位之和(100分) 试题编号: 201512-1 试题名称: 数位之和 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述 给定一个十进制整数n,输出n的各位数字之和。 输入格式 输入一个整数n。 输出格式 输出一个整数,表示答案。 样例输入 20151220 样例输出...
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; ...
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 ...
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];//等号后面的各元素个...
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{...
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...
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个整数,请按...
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() { ...
常见模板 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 >>...
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];//标记数...
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];/...
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. ...
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...
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...
2019CCPC网络赛——1003——K-th occurrence K-th occurrence Time Limit: 5000/5000 MS (Java/Others)Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 0Accepted Submission(s): 0 Problem Description You are given a st...
2019 CCPC网络赛——1007——Windows Of CCPC Windows Of CCPC Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 0Accepted Submission(s): 0 Problem Description In recent years, CCPC h...
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...
Saruman's Army POJ - 3069 ithinRunits of some palantir. Input The 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 ...
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...