Description Flip game squares. One side of each piece is white and the other one is black and each piece is lying either it's black or white side up. Each round you flip 3 to 5 pieces, thus changing the color of their upper side from black to white a…
Fire Net Problem Description Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a piece of wall. A blockhouse is a small castle that has four openings t…
Description The game “The Pilots Brothers: following the stripy elephant” has a quest where a player needs to open a refrigerator. There are 16 handles on the refrigerator door. Every handle can be in one of two states: open or closed. The refrigerat…
原题链接 Problem Description There are n people and m pairs of friends. For every pair of friends, they can choose to become online friends (communicating using online applications) or offline friends (mostly using face-to-face communication). However, e…
Minimal Ratio Tree Time Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 12 Accepted Submission(s) : 7 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description For a tree, which n…
POJ 2965 The Pilots Brothers' refrigerator Description The game “The Pilots Brothers: following the stripy elephant” has a quest where a player needs to open a refrigerator. There are 16 handles on the refrigerator door. Every handle can…
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37050 Accepted: 16122 Description Flip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the…
Smallest Difference Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 19528 Accepted: 5329 Description Given a number of distinct decimal digits, you can form one integer by choosing a non-empty subset of these digits and writing them in…
#include <stdio.h> #include <set> #include <string.h> #include <algorithm> using namespace std; ; ; double minans; int vis[maxn];//记录选中的点 int mp[maxn][maxn], ans[maxn][maxn]; int min_road[maxn]; int Prim(int n) { ; int dis[maxn]; i…
标题:倍数问题 [题目描述]众所周知,小葱同学擅长计算,尤其擅长计算一个数是否是另外一个数的倍数.但小葱只擅长两个数的情况,当有很多个数之后就会比较苦恼.现在小葱给了你 n 个数,希望你从这 n 个数中找到三个数,使得这三个数的和是 K 的倍数,且这个和最大.数据保证一定有解. [输入格式]从标准输入读入数据. 第一行包括 2 个正整数 n, K.第二行 n 个正整数,代表给定的 n 个数. [输出格式]输出到标准输出.输出一行一个整数代表所求的和. [样例入]4 31 2 3 4 [样例输出]…
Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which they manipulate an M × N grid (1 ≤ M ≤ 15; 1 ≤ N ≤ 15) of square tiles, each of which is colored black…