![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
思维
£xilm€
这个作者很懒,什么都没留下…
展开
-
1085: 战斗吧皇后!
在一个N*M的棋盘中,存在多少种方式使得两个皇后可以互相攻击。原创 2022-09-06 09:20:39 · 383 阅读 · 2 评论 -
结果填空:阶乘位数
思维||数学#include<bits/stdc++.h>using namespace std;typedef long long ll;const int N=5e5+5,tt=1000000;int a[N],b[N];int dd(ll x){ int s=0; while(x) { s++; x/=10; } return s;}int main(){ ios::sync_with_stdio(false); ll n; n=1;..原创 2022-04-08 10:39:48 · 162 阅读 · 0 评论 -
结果填空:加减乘
思想:搜索各种情况,进行判断#include<bits/stdc++.h>using namespace std;typedef long long ll;int a[11];int x[11],y[11];int n,m,s;void judge(){ int k=0,num=0,xx=1; for(int i=2; i<=10; i++) //先处理 * { if(a[i]==3) { num++; xx=xx*i; } el...原创 2022-04-08 10:28:06 · 270 阅读 · 0 评论 -
L1-039 古风排版 (20 分)
中国的古人写文字,是从右向左竖向排版的。本题就请你编写程序,把一段文字按古风排版。输入格式:输入在第一行给出一个正整数N(<100),是每一列的字符数。第二行给出一个长度不超过1000的非空字符串,以回车结束。输出格式:按古风格式排版给定的字符串,每列N个字符(除了最后一列可能不足N个)。样例:">输入样例:4This is a test case输出样例:asa Tst ihe tsi ce s#include<bits/stdc++.原创 2022-03-05 08:59:51 · 64 阅读 · 0 评论 -
L1-049 天梯赛座位分配 (20 分)
L1-049 天梯赛座位分配 (20 分)天梯赛每年有大量参赛队员,要保证同一所学校的所有队员都不能相邻,分配座位就成为一件比较麻烦的事情。为此我们制定如下策略:假设某赛场有 N 所学校参赛,第 i 所学校有 M[i] 支队伍,每队 10 位参赛选手。令每校选手排成一列纵队,第 i+1 队的选手排在第 i 队选手之后。从第 1 所学校开始,各校的第 1 位队员顺次入座,然后是各校的第 2 位队员…… 以此类推。如果最后只剩下 1 所学校的队伍还没有分配座位,则需要安排他们的队员隔位就坐。本题就要求你编写原创 2022-03-05 08:45:11 · 82 阅读 · 0 评论 -
字符串排序
hihoCoder一般我们在对字符串排序时,都会按照字典序排序。当字符串只包含小写字母时,相当于按字母表"abcdefghijklmnopqrstuvwxyz"的顺序排序。 现在我们打乱字母表的顺序,得到一个26个字母的新顺序。例如"bdceafghijklmnopqrstuvwxyz"代表'b'排在'd'前,'d'在'c'前,'c'在'e'前…… 给定N个字符串,请你按照新的字母顺序对它们排序。Input第一行包含一个整数N。(1 <= N <= 1000)第二行包..原创 2021-11-30 10:33:52 · 852 阅读 · 0 评论 -
N个有理数数求和
L1-009 N个数求和 (20 分)本题的要求很简单,就是求N个数字的和。麻烦的是,这些数字是以有理数分子/分母的形式给出的,你输出的和也必须是有理数的形式。输入格式:输入第一行给出一个正整数N(≤100)。随后一行按格式a1/b1 a2/b2 ...给出N个有理数。题目保证所有分子和分母都在长整型范围内。另外,负数的符号一定出现在分子前面。输出格式:输出上述数字和的最简形式 —— 即将结果写成整数部分 分数部分,其中分数部分写成分子/分母,要求分子小于分母,且它们没有公因子。如果结果原创 2021-11-21 17:24:35 · 476 阅读 · 0 评论 -
PTA.7-2后缀式求值
我们人类习惯于书写“中缀式”,如3 + 5 * 2,其值为13。 (p.s. 为什么人类习惯中缀式呢?是因为中缀式比后缀式好用么?)而计算机更加习惯“后缀式”(也叫“逆波兰式”,Reverse Polish Notation)。上述中缀式对应的后缀式是:3 5 2 * +现在,请对输入的后缀式进行求值。输入格式:在一行中输入一个后缀式,运算数和运算符之间用空格分隔,运算数长度不超过6位,运算符仅有+ - * /四种。输出格式:在一行中输出后缀式的值,保留一位小数。输入样例...原创 2021-11-21 16:01:46 · 2167 阅读 · 4 评论 -
Intersection(线段相交)
You are to write a program that has to decide whether a given line segment intersects a given rectangle.An example:line: start point: (4,9)end point: (11,2)rectangle: left-top: (1,5)right-bottom: (7,1)Figure 1: Line segment does not intersect r.原创 2021-10-20 21:22:28 · 188 阅读 · 0 评论 -
2021-06-20
This is the easy version of the problem. The only difference is that in this version n≤2000. You can make hacks only if both versions of the problem are solved.There are n potions in a line, with potion 1 on the far left and potion n on the far right. Eac转载 2021-06-20 08:54:08 · 92 阅读 · 0 评论 -
2021-06-06
You are given an array a of length n consisting of integers. You can apply the following operation, consisting of several steps, on the array a zero or more times:you select two different numbers in the array ai and aj;you remove i-th and j-th elements f原创 2021-06-06 15:10:08 · 88 阅读 · 0 评论 -
2021-05-30
A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.You are given a positive integer n. Represent it as a sum of minimum number o原创 2021-05-30 15:39:55 · 38 阅读 · 0 评论