随笔分类 - ACM
摘要:牛客网拼多多面试题: 多多君最近在研究某种数字组合:定义为:每个数字的十进制表示中(0~9),每个数位各不相同且各个数位之和等于N。满足条件的数字可能很多,找到其中的最小值即可。多多君还有很多研究课题,于是多多君找到了你--未来的计算机科学家寻求帮助。 输入描述: 共一行,一个正整数N,如题意所示,
阅读全文
摘要:题解题目:CodeForces - 602B CodeForces - 717E CodeForces - 746G Codeforce 602B Approximating a Constant Range When Xellos was doing a practice course in un
阅读全文
摘要:巴什博弈巴什博弈 nim游戏 A与B轮流取石子,有n颗石子,每次取1~3个。取走最后一颗石子的人胜利。 A,B均采用最优策略 当n为0,4, 8, 12…时,B胜利。其他情况,A胜利。 当n为0时,A取不出石子,A输 当n为4时,A取1~3,B取4-numA, A取不出,A输 … B每次取(numB
阅读全文
摘要:A. Vasya and Book 题意: 给四个数据 n, x, y, d。 n为书总共多少页,x为当前页数,y为目标页数,一次必须翻d页,但是范围在1~n,询问最少翻的次数 情况 1. abs(x-y)%d == 0 正好到达 则输出 abs(x-y)/d 2.往前翻到 1 此时为1 到 y 。
阅读全文
摘要:set insert到容器中后自动从小到大排序 元素不会重复插入 输出用迭代器 正向iterator 反向reverse_iterator it, s.begin(), s.end() 均为地址 输出加* 1 插入 s.insert(); 2 获得当前元素个数 s.size(); 3 查找set中元
阅读全文
摘要:A 棋盘问题 #include<cstdio> #include<cmath> #include<cstring> #include<algorithm> using namespace std; char mp[12][12]; int n, k, ans, b[12], m; void dfs(
阅读全文
摘要:传送门 树状数组,一个树状数组会T, 采用两个树状数组。 一个存a[1] + a[2] + a[3] + ... a[n -1] + a[n] ; 另一个存n * a[1] + (n-1) * a[2] + (n-2) * a[3] +... 2 * a[n-1] + a[n] ; ans1 = g
阅读全文
摘要:输入:n, k题目:给n个数字,有多少组数字加起来等于k使用dfs深搜, 代码如下#include<cstdio> #include<cmath> #include<iostream> #include<cstring> #include<cstdlib> #include<string> #inc
阅读全文
摘要:题目链接Alice lives in the country where people like to make friends. The friendship is bidirectional and if any two person have no less than k friends in
阅读全文
摘要:Problem Statement "Teishi-zushi", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is
阅读全文
摘要:High school student Vasya got a string of length n as a birthday present. This string consists of letters 'a' and 'b' only. Vasya denotes beauty of th
阅读全文
摘要:Due to the increase in the number of students of Berland State University it was decided to equip a new computer room. You were given the task of buyi
阅读全文
摘要:B. Not simply beatiful strings time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Let's call
阅读全文
摘要:Mr. Takahashi has a string s consisting of lowercase English letters. He repeats the following operation on s exactly K times. Choose an arbitrary let
阅读全文
摘要:Jeff has become friends with Furik. Now these two are going to play one quite amusing game. 题目链接:http://codeforces.com/problemset/problem/351/B 题目大意:
阅读全文
摘要:使学号和成绩关联,然后成绩sort,学号也跟着改变。 代码: #include<cstdio> #include<cmath> #include<algorithm> #include<cstring> using namespace std; const int MaxN = 1e5; struc
阅读全文
摘要:题目开头:Youare given sequence a1, a2, ..., an of integer numbers of length n. Your task is to find such subsequence that itssum is odd and maximum among
阅读全文