Problem Statement
The Kingdom of AtCoder is composed of N towns and N−1 roads.
The towns are labeled as Town 1, Town 2, …, Town N. Similarly, the roads are labeled as Road 1, Road 2, …, Road N−1. Road i connects Towns Ai and Bi bidirectionally, and you have to pay the toll of Ci to go through it.
题目描述
After spending so much time around his cows, Farmer John has started to understand their language. Moreover, he notices that among his N cows (2 ≤ N ≤ 1000 ), some always tell the truth while others always lie.
题目描述
All boring tree-shaped lands are alike, while all exciting tree-shaped lands are exciting in their own special ways.What makes Treeland more exciting than the other tree-shaped lands are the raddest radio hosts in the local area: Root and Leaf.
A Quality-Adjusted Life-Year
B Gwen’s Gift
C Forest for the Trees
D H-Index
E Driving Lanes
F Treasure Spotting
G Neighborhood Watch
H Small Schedule
I Mr. Plow King
J Rainbow Road Race
题目描述
In a postfix expression, operators follow their operands. For example, [ 5 2 * ] is interpreted as 5 * 2. If there are multiple operators, each operator appears after its last operand. Here are more examples, showing how postfix compares to parenthesized expressions:
题意:
给出一个长度为n nn的序列,问有多少种方案数使得挑选四个位置满足ABBA这种情况
即 1 ≤ a < b < c < d ≤ n 1 \leq a < b < c < d \leq n1≤a<b<c<d≤n,且满足
① n u m [ a ] = n u m [ d ] n u m [ b ] = n u m [ c ] num[a] = num[d] \ \ num[b] = num[c]num[a]=num[d] num[b]=num[c]
② n u m [ a ] ≠ n u m [ b ] num[a] \neq num[b]num[a]
题意:
有n堆石子,后手可以在游戏开始之前挪走不超过d堆,然后问后手赢得游戏的方案数量 % 1e9 + 7
思路:
先求出所有数的亦或和
设d p [ i ] [ j ] [ k ] dp[i][j][k]dp[i][j][k]为前 i ii 堆石子挪走 j jj 堆,并且亦或和为 k kk 的方案数
然后进行dp
题目描述
There’s a new art installation in town, and it inspires you… to play a childish game. The art installation consists of a floor with an n×n matrix of square tiles. Each tile holds a single number from 1 to k. You want to play hopscotch on it.
题意:
给定一个n ∗ n n * nn∗n的矩阵,其中在X XX上一定不可以放置船,而在O OO上面一定要放置船,在′ . ′ '.'
上面可以放置船,也可以不放,问将以下m mm艘船,大小均为1 ∗ x 1 * x1∗x,放置在矩阵中的方案数量
思路:
类似经典的八皇后问题,
首先将所有的m个都成功放置之后,并且所有的O均已成功放置船艘,此时的方案书就应该 + 1
注意船的形状一共有两种情况:横着和竖着,但是对于1 * 1的情况来说就只有一种状态,这里要特判掉
我们用j u d g e ( ) judge()judge()函数来判断是否能够是否可以放置该船,
题意:
给出一个数n nn,构造出一个数列 a 1 . . . a m a_1 ... a_ma
1
...a
m
,使得所有数之和a 1 + . . . + a m a_1 + ... + a_ma
1
+...+a
m
为n nn,并且还要使得a 1 ∣ . . . ∣ a m a_1 | ... | a_ma
1
∣...∣a
m
尽可能的小,问最小的o r oror运算之后的值是多少
首先可以看到题目的数据范围很大,考虑使用Java大数B i g I n t e g e r BigIntegerBigInteger
题目描述
给出一个包含 n nn 个点和 m mm 条边的有向图(下面称其为网络) G = ( V , E ) G=(V,E)G=(V,E),该网络上所有点分别编号为 1 ∼ n 1 \sim n1∼n,所有边分别编号为 1 ∼ m 1\sim m1∼m,其中该网络的源点为 s ss,汇点为t tt,网络上的每条边 ( u , v ) (u,v)(u,v) 都有一个流量限制 w ( u , v ) w(u,v)w(u,v)和单位流量的费用 c ( u , v ) c(u,v)c(u,v)。
题目描述
小 Y 是一个爱好旅行的 OIer。她来到 X 国,打算将各个城市都玩一遍。
小Y了解到, X国的 n 个城市之间有 m 条双向道路。每条双向道路连接两个城市。 不存在两条连接同一对城市的道路,也不存在一条连接一个城市和它本身的道路。并且, 从任意一个城市出发,通过这些道路都可以到达任意一个其他城市。小 Y 只能通过这些 道路从一个城市前往另一个城市。
Array
Time Limit: 15000/8000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 965 Accepted Submission(s): 312
Problem Description
Given an integer array a[1…n].