- 博客(61)
- 收藏
- 关注
原创 基础算法 —— 高精度计算 —— Java 大数类
【概述】在 C++ 中数据类型的长度最多能到 64 位,一旦超出这个位数,就要用数组进行模拟计算,即高精度算法而在 Java 中有两个类:BigInteger、BigDecimal 分别表示大整数类和大浮点数类,其理论上能表示无限大的数,只要计算机内存足够大。这两个类都是 Number 类的子类,但存放在 java.math.* 包中,因此每次使用必须在开头处引用该包。【常量】...
2019-05-31 22:19:08 543
原创 C++语言基础 —— STL —— 容器与迭代器 —— bitset
【概述】bitset 位于 <bitset> 头文件中,其是 STL 的一部分,准确地说,bitset 是一个模板类而不是容器,其模板参数不是类型,而整型的数值,即:bitset <N>bitset 存储的是二进制位,与一个 bool 型的数组相似,其每位只占一个字节,极大的优化了空间,使用 bitset 可以像使用数组一样利用位。【定义】bitset 的...
2019-05-31 16:19:37 618
原创 No Need(AtCoder-2346)
Problem DescriptionAtCoDeer the deer has N cards with positive integers written on them. The number on the i-th card (1≤i≤N) is ai. Because he loves big numbers, he calls a subset of the cards good...
2019-05-31 15:59:48 396
原创 Go Home(AtCoder-2354)
Problem DescriptionThere is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i−1 and time i, the kangaroo can either sta...
2019-05-31 15:13:13 353
原创 Menagerie(AtCoder-2234)
Problem DescriptionSnuke, who loves animals, built a zoo.There are N animals in this zoo. They are conveniently numbered 1 through N, and arranged in a circle. The animal numbered i(2≤i≤N−1) is a...
2019-05-30 18:07:28 1851
原创 Scc Puzzle(AtCoder-2333)
Problem DescriptionSnuke loves puzzles.Today, he is working on a puzzle usingS- andc-shaped pieces. In this puzzle, you can combine twoc-shaped pieces into oneS-shaped piece, as shown in the ...
2019-05-30 16:24:29 489
原创 Card Eater(AtCoder-2299)
Problem DescriptionSnuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer Ai is written.He will perform the operation describ...
2019-05-30 14:48:08 366
原创 X: Yet Another Die Game(AtCoder-2298)
Problem DescriptionSnuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7.Snuke will first put th...
2019-05-30 13:57:57 400
原创 Walk and Teleport(AtCoder-2287)
Problem DescriptionThere are N towns on a line running east-west. The towns are numbered 1 through N, in order from west to east. Each point on the line has a one-dimensional coordinate, and a poin...
2019-05-28 17:58:40 305
原创 Factors of Factorial(AtCoder-2286)
Problem DescriptionYou are given an integer N. Find the number of the positive divisors of N!, modulo 109+7.Constraints1≤N≤103InputThe input is given from Standard Input in the following for...
2019-05-28 17:30:16 318
原创 Xor Sum(AtCoder-2272)
Problem DescriptionYou are given a positive integer N. Find the number of the pairs of integers u and v (0≦u,v≦N) such that there exist two non-negative integers a and b satisfying a xor b=u and a+...
2019-05-27 22:02:01 528
原创 Lining Up(AtCoder-2271)
Problem DescriptionThere are N people, conveniently numbered 1 through N. They were standing in a row yesterday, but now they are unsure of the order in which they were standing. However, each pers...
2019-05-27 21:28:01 729
原创 石头剪刀布
【题目描述】wzms 今年举办了一场剪刀石头布大赛,bleaves 被选为负责人。比赛共有2n2n 个人参加, 分为 n 轮,在每轮中,第 1 位选手和第 2 位选手对战,胜者作为新的第 1 位选手,第 3 位和第 4 位对战,胜者作为新的第 2 位选手,以此类推。bleaves 调查得知,每个人都有其偏爱决策,每个人在每一次对战中都会使用他的偏爱决策。如果一次对战的双方的...
2019-05-27 16:22:30 564
原创 海啸
【题目描述】有一个沿海地区,可以看作有n行m列的城市,第i行第j列的城市海拔为h[j]。由于沿海,所以这个地区经常会发生海啸。海啸发生时,部分城市会被淹没,具体来说,海水高度会达到d,因此海拔低于d的城市都会被淹没。现在有q次询问,每次问你一个矩形区域中,有多少城市不会被淹没。【输入描述】第一行三个整数n,m,d,具体含义见题目描述。接下来n行,每行m个整数,其中第i行第j列...
2019-05-27 16:09:31 305
原创 煤气灶
【题目描述】小j开始打工,准备赚钱买煤气灶。第一天,小j的工资为n元,之后每天他的工资都比前一天多d元。已知煤气灶需要m元,求小j最少工作几天才能买到煤气灶。【输入描述】四个整数 n,m,d,x分别表示小j第一天的工资,煤气灶的价格,工资每天的增长量,答案不超过x【输出描述】一个数表示答案【样例】示例1输入10 100 20 100输出4说明10+...
2019-05-26 14:42:39 343
原创 連結 / Connectivity(AtCoder-2159)
Problem DescriptionThere are N cities. There are also K roads and L railways, extending between the cities. The i-th road bidirectionally connects the pi-th and qi-th cities, and the i-th railway b...
2019-05-23 17:17:56 380
原创 白昼夢 / Daydream(AtCoder-2158)
Problem DescriptionYou are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S=T by performing the following ...
2019-05-23 15:43:45 381
原创 An Ordinary Game(AtCoder-2153)
Problem DescriptionThere is a string s of length 3 or greater. No two neighboring characters in s are equal.Takahashi and Aoki will play a game against each other. The two players alternately per...
2019-05-23 15:13:06 324
原创 Boxes and Candies(AtCoder-2152)
Problem DescriptionThere are N boxes arranged in a row. Initially, the i-th box from the left contains ai candies.Snuke can perform the following operation any number of times:Choose a box cont...
2019-05-23 13:38:36 505
原创 高橋君と見えざる手 / An Invisible Hand(AtCoder-2147)
Problem DescriptionThere are N towns located in a line, conveniently numbered 1 through N. Takahashi the merchant is going on a travel from town 1 to town N, buying and selling apples.Takahashi w...
2019-05-22 22:33:04 387
原创 一次元リバーシ / 1D Reversi(AtCoder-2146)
Problem DescriptionTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each p...
2019-05-22 21:33:33 523
原创 くんと選挙速報 / AtCoDeer and Election Report (AtCoder-2140)
Problem DescriptionAtCoDeer the deer is seeing a quick report of election results on TV. Two candidates are standing for the election: Takahashi and Aoki. The report shows the ratio of the current ...
2019-05-22 20:35:59 312
原创 くんと変なじゃんけん / AtCoDeer and Rock-Paper (AtCoder-2141)
Problem DescriptionAtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of N turns. In each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-pa...
2019-05-22 20:16:02 371
原创 すぬけ君の地下鉄旅行 / Snuke's Subway Trip(AtCoder-2069)
Problem DescriptionSnuke's town has a subway system, consisting ofNstations andMrailway lines. The stations are numbered1throughN. Each line is operated by a company. Each company has an ide...
2019-05-21 14:05:16 459
原创 すぬけ君の塗り絵 / Snuke's Coloring(AtCoder-2068)
Problem DescriptionWe have a grid withHrows andWcolumns. At first, all cells were painted white.Snuke paintedNof these cells. Thei-th (1≤i≤N) cell he painted is the cell at theai-th row...
2019-05-21 13:09:25 369
原创 たくさんの数式 / Many Formulas(AtCoder-2067)
Problem DescriptionYou are given a string S consisting of digits between 1 and 9, inclusive. You can insert the letter + into some of the positions (possibly none) between two letters in this strin...
2019-05-20 20:50:59 410
原创 高橋君とホテル / Tak and Hotels(AtCoder-2039)
Problem DescriptionN hotels are located on a straight line. The coordinate of the i-th hotel (1≤i≤N) is xi.Tak the traveler has the following two personal principles:He never travels a distance...
2019-05-20 14:58:46 455
原创 桁和 / Digit Sum(AtCoder-2038)
Problem DescriptionFor integersb(b≥2)andn(n≥1), let the functionf(b,n)be defined as follows:f(b,n)=n, whenn<b f(b,n)=f(b, floor(n⁄b))+(nmodb), whenn≥bHere,floor(n⁄b)denotes the la...
2019-05-19 22:00:35 509
原创 高橋君とカード / Tak and Cards(AtCoder-2037)
Problem DescriptionTak has N cards. On the i-th (1≤i≤N) card is written an integer xi. He is selecting one or more cards from these N cards, so that the average of the integers written on the selec...
2019-05-19 19:07:11 516
原创 キャンディーとN人の子供 / Children and Candies(AtCoder-2021)
Problem Description12:17 (UTC): The sample input 1 and 2 were swapped. The error is now fixed. We are very sorry for your inconvenience.There are N children in AtCoder Kindergarten, conveniently ...
2019-05-19 16:47:17 488
原创 アンバランス / Unbalanced(AtCoder-2020)
Problem DescriptionGiven a stringt, we will call itunbalancedif and only if the length oftis at least2, and more than half of the letters intare the same. For example, bothvoodooandmelee...
2019-05-19 15:27:13 2913
原创 いっしょ / Be Together(AtCoder-2019)
Problem DescriptionEvi has N integers a1,a2,..,aN. His objective is to have N equal integers by transforming some of them.He may transform each integer at most once. Transforming an integer x int...
2019-05-19 13:12:03 366
原创 いろはちゃんとマス目 / Iroha and a Grid(AtCoder-1974)
Problem DescriptionWe have a large square grid with H rows and W columns. Iroha is now standing in the top-left cell. She will repeat going right or down to the adjacent cell, until she reaches the...
2019-05-18 22:32:41 349
原创 こだわり者いろはちゃん / Iroha's Obsession(AtCoder-1973)
Problem DescriptionIroha is very particular about numbers. There areKdigits that she dislikes:D1,D2,…,DK.She is shopping, and now paying at the cashier. Her total isNyen (the currency of Jap...
2019-05-18 20:46:31 2484 2
原创 炫酷迷宫
【题目描述】小希现在需要你构建一个简单的方格图迷宫,'.'作为路,'x'作为障碍。要求方格图大小为N*M,起点到终点的最短距离恰好为K。方格图为四连通,即对于任何一个格子只能上下左右走,相邻格子距离为1,不能走出边界。【输入描述】一行给出三个整数N,M,K,分别表示需要的方格图的行数,列数和起点到终点的最短距离。1≤N,M≤10001≤K≤N∗M且保证可以构造出至少...
2019-05-14 08:11:16 378
原创 2019 年“浪潮杯”第十届山东省 ACM 省赛总结
弱校 ACMer,第二次参加省赛,最后拿到了铜,结果不好不坏吧5 月 11 早上到的济大,签到领衬衫领参赛证然后去酒店,一套常规流程下来后队友们都去酒店了,因为家是济南的,于是我就回家了。。。下午开幕式没去,直接去的热身赛,4 道题 3 道原题,一人一道出了的很快,然后测了测环境,最后的 D 题给出题人跪了,什么神仙题。。。5 月 12 正赛,以什么机制开题、谁负责什么工作、变量命名规范等...
2019-05-13 15:59:59 1962 2
原创 小b删列(51Nod-2523)
题目小b有一个n*m的矩阵A,矩阵的每个元素为一个字符,现在她希望删除其中的一些列,使得剩下的列在每一行形成的字符串的字典序不降。即对于第i行,将剩下的列上的字符顺序拼接,形成一个字符串,记作a[i]。要求a[i]<=a[i+1](i=1..n-1)。请问小b最少要删多少列。如A = {"abcdef", "uvwxyz"},删除的列为第1,3,4列,删除后 A 为{"be...
2019-05-13 15:58:44 288 2
原创 和为k的倍数(51Nod-2522)
题目小b喜欢和为K的倍数的序列。现在有一个长度为n的序列A,请问A有多少个非空连续子序列是小b喜欢的。输入第一行输入一个正整数n;第二行输入n个整数,表示A[i],以空格隔开;第三行输入一个正整数K;其中1≤n≤30000,对于任意A[i]有-10000≤A[i]≤10000,2≤K≤10000输出输出一个数,表示子序列的数目输入样例64 5 0 -2 -...
2019-05-13 15:52:41 1826 1
原创 重排列(51Nod-2513)
题目有两个长度为n的序列A,B,你需要重排列A,使得满足A[i]>B[i]的i的数目尽量大。只需输出这个最大个数即可。输入第一行输入一个正整数n;第二、三行分别输出n个非负整数,表示A、B中的元素,以空格隔开;其中1≤n≤10000,0≤A[i],B[i]≤10^9。输出输出一行一个数,表示最大个数输入样例42 7 11 151 10 4 11输...
2019-05-13 15:36:16 325
原创 重排列得到2的幂(51Nod-2515)
题目小b有一个数n,现在她想把n的每一位重排列,使得得到的结果为2的幂次。请问小b能得到2的幂次吗?注意重排列后不允许有前导0。样例解释:46重排列成64,为2^6。输入输入一个数N,其中1≤N≤10^9输出满足条件,输出“true”;不满足,则输出“false”。输入样例46输出样例true思路:提前将 2^i 打好表,然后对于数字 n ...
2019-05-13 15:03:08 542
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人