题目连接: https://vjudge.net/problem/1502082/origin 这一题第一眼看过去貌似是模拟,但是根据其范围是1e9可以知道,如果暴力解基本上是不可能的(不排除大佬级优化) 于是对1---9进行计算可以得到如下结果: 1 --- 1 2 --- 2 3 --- 2 4 --- 3 5 --- 3 6 --- 4 7 --- 4 8 --- 5 9 --- 5 故而有得到规律 n --- n/2+1 根据规律得到代码: #include <iostream> #i…
D. Roman Digits time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Let's introduce a number system which is based on a roman digits. There are digits I, V, X, L which correspond to the numbers…
题目传送门 /* 找规律/贪心:ans = n - 01匹配的总数,水 */ #include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <cmath> using namespace std; ; const int INF = 0x3f3f3f3f; char s[MAXN]; int main(void) //Codeforce…
题目传送门 /* 数学/暴力:只要一个数的最后三位能被8整除,那么它就是答案:用到sprintf把数字转移成字符读入 */ #include <cstdio> #include <algorithm> #include <cstring> #include <iostream> #include <cmath> #include <vector> using namespace std; ; const int INF = 0x3f3…
C. Unfair Poll time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output On the Literature lesson Sergei noticed an awful injustice, it seems that some students are asked more often than others. Seat…
题目:https://cn.vjudge.net/problem/Gym-101775L PS:训练赛中被这道题折磨的不轻,和队友反复推必胜态与必败态试图推导出公式或者规律,然后推的心态逐渐失控,,,最后十分钟没辙了,队友站在一起,猜,猜一个规律出来,emmm,比赛半路中不经意听到旁边打过这场EC-final现场赛的学长说这题打表找规律,还在对面A题后讨论中听到16和偶数,嘿嘿,于是迫不得已猜规律,比赛还剩三十秒时交上去第三个规律,就,,,就A了,,,和另一位队友逗比的叫了起来,emmm,感觉r…
题目链接: http://codeforces.com/problemset/problem/353/D?mobile=true H. Queue time limit per test 1 secondmemory limit per test 256 megabytes 问题描述 There are n schoolchildren, boys and girls, lined up in the school canteen in front of the bun stall. The b…
A. Hanoi tower Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100114 Description you the conditions of this task. There are 3 pivots: A, B, C. Initially, n disks of different diameter are placed on the pivot A: the smallest dis…
题目链接: https://codeforces.com/contest/166/problem/E 题目: 题意: 给你一个三菱锥,初始时你在D点,然后你每次可以往相邻的顶点移动,问你第n步回到D点的方案数. 思路: 打表找规律得到的序列是0,3,6,21,60,183,546,1641,4920,14763,通过肉眼看或者oeis可以得到规律为. dp计数:dp[i][j]表示在第i步时站在位置j的方案数,j的取值为[0,3],分别表示D,A,B,C点,转移方程肯定是从其他三个点转移. 代码…
题目传送门 /* 找规律,水 */ #include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <cmath> using namespace std; ; const int INF = 0x3f3f3f3f; ]; int main(void) //Codeforces Round #309 (Div. 2) A. Kyoya a…