Rock-Paper-Scissors   Rock-Paper-Scissors is a two-player game, where each player chooses one of Rock, Paper, or Scissors. Here are the three cases in which a player gets one  point: ­          Choosing Rock wins over a player choosing  scissors. ­  …
Runtime Error   Bahosain was trying to solve this simple problem, but he got a Runtime Error on one of the test cases, can you help him by solving it? Given an array of N non-negative integers and an integer K, your task is to find two integers X and…
Heavy Coins   Bahosain has a lot of coins in his pocket. These coins are really heavy, so he always tries to get rid of some of the coins by using them when paying for the  taxi. Whenever Bahosain has to pay S pennies for the taxi driver, he tries to…
Travelling Salesman   After leaving Yemen, Bahosain now works as a salesman in Jordan. He spends most of his time travelling between different cities. He decided to buy a new car to help him in his job, but he has to decide about the capacity of the…
Epic Professor   Dr. Bahosain works as a professor of Computer Science at HU (Hadramout    University). After grading his programming exam, he noticed that most of the students have failed. Since this is the last semester for him teaching in Yemen, D…
Street Lamps   Bahosain is walking in a street of N blocks. Each block is either empty or has one lamp. If there is a lamp in a block, it will light it’s block and the direct adjacent blocks. For example, if there is a lamp at block 3, it will light…
2018 ACM-ICPC 中国大学生程序设计竞赛线上赛:https://www.jisuanke.com/contest/1227 题目链接:https://nanti.jisuanke.com/t/26219 Rock Paper Scissors Lizard Spock Description: Didi is a curious baby. One day, she finds a curious game, which named Rock Paper Scissors Lizard…
题目戳我 \(\text{Solution:}\) 考虑第二问,赢的局数最小,即输和平的局数最多. 考虑网络流,\(1,2,3\)表示\(Alice\)选择的三种可能性,\(4,5,6\)同理. 它们像源点和汇点连的是局数为容量的边,然后对于能和它平的和输的连边,边权为\(inf\),因为源点和汇点已经限制了流量,这里直接\(inf\)即可. 第一问就是三个数的三个最小值相加. #include<bits/stdc++.h> using namespace std; int n,a[4],b[…
一眼题. 第一问很简单吧,就是每个 \(\tt Alice\) 能赢的都尽量让他赢. 第二问很简单吧,就是让 \(\tt Alice\) 输的或平局的尽量多,于是跑个网络最大流.\(1 - 3\) 的点表示 \(\tt Alice\) 选石头剪刀或布,\(4-6\) 表示\(\tt Bob\) 选石头剪刀或布.显然源点连 \(1-3\), \(4-6\) 连汇点.然后把 \(\tt Alice\) 输或 \(\tt Alice\) 平的连一下就好了呀. #include<bits/stdc++.…
就是改成把一个字符串改成三进制状压,然后分成前5位,后5位统计, 然后直接统计 f[i][j][k]代表,后5局状压为k的,前5局比和j状态比输了5局的有多少个人 复杂度是O(T*30000*25*m)m比较小,也就最多几十吧,将将过 #include <cstdio> #include <cstring> #include <algorithm> #include <iostream> #include <cstdlib> #include &…