思维题
文章平均质量分 56
小自洽
孤独患者
展开
-
栈(括号匹配,海豚对视,大鱼吃小鱼)
Speed down, Colombooo!!! rowing coach, Gabi As common sense tells us, competitive programmers excel at rowing. The olympic lane is a wonderful place to row, run and work out. What few take their tim...原创 2018-08-13 09:21:03 · 434 阅读 · 0 评论 -
周赛(5)C - 翻翻棋(未补代码)
象棋翻翻棋(暗棋)中双方在4*8的格子中交战,有时候最后会只剩下帅和将。根据暗棋的规则,棋子只能上下左右移动,且相同的级别下,主动移动到地方棋子方将吃掉对方的棋子。将和帅为同一级别。然而胜负在只剩下帅和将的时候已定。Input 第一行T,表示T组数据。每组数据共有四行字符串,每行字符串共八个字符’#’表示空格’*’表示红方帅’.’表示黑方将此时红方先走每组输入之间没有...原创 2018-08-24 21:31:02 · 357 阅读 · 0 评论 -
周赛(5)A - 0和5(8.24未补代码)
小K手中有n张牌,每张牌上有一个一位数的数,这个字数不是0就是5。小K从这些牌在抽出任意张(不能抽0张),排成一行这样就组成了一个数。使得这个数尽可能大,而且可以被90整除。注意:1.这个数没有前导0,2.小K不需要使用所有的牌。Input 每个测试数据输入共2行。 第一行给出一个n,表示n张牌。(1<=n<=1000) 第二行给出n个整数a0,a1,a2,…...原创 2018-08-24 20:32:51 · 180 阅读 · 0 评论 -
H - Number Sequence(15)
一个序列 g(1) = 1, g(2) = 1, g(m) = (x * g(m - 1) + y * g(m - 2)) % 7. 现给你x, y, m, 请计算出g(m)的值。 Input 多组输入数据。每组输入数据包含3个整数x, y,和m(数据保证1 <= x, y <= 1000, 1 <= m <= 100,000,000)。若x, y, m均为0...原创 2018-08-21 14:16:14 · 344 阅读 · 0 评论 -
C. Songs Compression(贪心)
C. Songs Compression time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Ivan has n songs on his phone. The size of the i -th song is ...原创 2018-08-23 07:09:47 · 308 阅读 · 0 评论 -
E - Digital Roots(10)(树根公式)
一个数的“魔幻数字”是指它所有位数上的数之和,如果“魔幻数字”仅有一位,则被称为这个数的“究极魔幻数字”,如果“魔幻数字”有两位及两位以上,则需重复寻找“魔幻数字”的步骤,直到找到“究极魔幻数字”。 例如,对于一个正整数128,它的“魔幻数字”为11,但11有两位,所以重复之前的步骤,得到11的“魔幻数字”为2,2仅有一位数,则2是我们需要的“究极魔幻数字”。 Input 多组输入数据,...原创 2018-08-22 23:46:21 · 447 阅读 · 0 评论 -
C - Flip the Bits (二进制的翻转)
You are given a positive integer n. Your task is to build a number m by flipping the minimum number of bits in the binary representation of n such that m is less than n (m < n) and it is as maximal...原创 2018-08-22 17:25:52 · 925 阅读 · 0 评论 -
B - Friends and Cookies (思维题)
Abood’s birthday has come, and his n friends are aligned in a single line from 1 to n, waiting for their cookies, Abood has x cookies to give to his friends.Here is an example to understand how Aboo...原创 2018-08-22 17:12:24 · 294 阅读 · 0 评论 -
A. Palindromic Twist(字符串变化+回文的判断)
题目链接 A. Palindromic Twist time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output You are given a string s consisting of n lowercase Lat...原创 2018-08-19 20:25:09 · 376 阅读 · 0 评论 -
C. Minimum Value Rectangle(基本不等式等式成立的条件)
题目链接 C. Minimum Value Rectangle time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output You have n sticks of the given lengths.Your task i...原创 2018-08-19 20:15:35 · 750 阅读 · 0 评论 -
B.Numbers on the Chessboard(矩阵中放数)
题目链接 题意: 题意:在矩阵里面放数,先把横纵坐标之和是偶数的放满,从左往右,从上往下,然后从最小的奇数(横纵坐标之和)开始继续往后放数;直到把n*n这些数放完#include<stdio.h>#include<stdlib.h>#include<string.h>int main(){ long long int n,m; ...原创 2018-08-19 19:22:18 · 454 阅读 · 0 评论 -
多元运算
I - 简单计算器(20) 读入一个只包含 +, -, *, / 的非负整数计算表达式,计算该表达式的值。 Input 测试输入包含若干测试用例,每个测试用例占一行,每行不超过200个字符,整数和运算符之间用一个空格分隔。没有非法表达式。当一行中只有0时输入结束,相应的结果不要输出。 Output 对每个测试用例输出1行,即该表达式的值,精确到小数点后2位。 Sample In...原创 2018-08-16 18:56:47 · 815 阅读 · 0 评论 -
B. Badge(模拟题,输出第二个被罚的人)
B. Badge time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output In Summer Informatics School, if a student doesn’t behave well, teachers make a h...原创 2018-08-22 07:10:28 · 732 阅读 · 0 评论 -
最大公因子(辗转相除法)递归版
♬ Caloventor tiene miedo… ♬ Benedetto, Nathan As is well known by any cultured person, rats are the smartest beings on earth. Followed directly by dolphins.MaratonIME knows about the species hiera...原创 2018-08-13 14:08:42 · 959 阅读 · 0 评论 -
动态规划
If we organize it correctly, … Unknown To make the trip to the subway less boring and tiring, the SPSU, Sao Paulo State University, tried one of its most famous inventions: buses with Infinite Inner...原创 2018-08-13 11:09:37 · 230 阅读 · 0 评论 -
(小鲤鱼加油站5)(H)O - Playing With Strings(未补代码)
Dani and Mike are two kids ,They are playing games all day and when they don’t find a game to play they invent a game . There is about an hour to arrive to school, because they love playing with strin...原创 2018-08-29 18:06:19 · 398 阅读 · 0 评论