http://codeforces.com/gym/100712/attachments 题意: 给出一串数字,每次选择连续的k个数字加上任意数(超过10就取余),最后要使得所有数字都相等,求最大的k. 思路: 开关翻转问题. 算法具体可以参考<挑战程序竞赛>常用技巧篇. 这道题目就是在枚举k的同时再枚举一下最后要转换成的数字即可. #include<iostream> #include<algorithm> #include<cstring> #inclu…
A number of K balls are dropped one by one from the root of a fully binary tree structure FBT. Each time the ball being dropped first visits a non-terminal node. It then keeps moving down, either follows the path of the left subtree, or follows the p…
Solved A Gym 100712A Who Is The Winner Solved B Gym 100712B Rock-Paper-Scissors Solved C Gym 100712C Street Lamps Solved D Gym 100712D Alternating Strings Solved E Gym 100712E Epic Professor Solved F Gym 100712F Travelling Salesman Solved G Gym 10071…
[题目链接] A - Who Is The Winner 模拟. #include <bits/stdc++.h> using namespace std; int T; int n; struct X { string name; int num; int ti; }s[10010]; bool cmp(X&a,X&b){ if(a.num != b.num) return a.num > b.num; return a.ti < b.ti; } int main…
Power Analysis是芯片设计实现中极重要的一环,因为它直接关系到芯片的性能和可靠性.Power Analysis 需要Timing Analysis 产生包含频率.transition 等时序信息的 Timing File,也需要包含Net Capacitance和Resistance信息的SPEF文件,功耗分析工具根据timing file 和RC value计算功耗或者分析IR-Drop/EM. 在介绍数字后端Power Signoff Flow之前,先大概论述一下芯片的功耗构成和…
B. Light bulbs There are NNN light bulbs indexed from 000 to N−1N-1N−1. Initially, all of them are off. A FLIP operation switches the state of a contiguous subset of bulbs. FLIP(L,R)FLIP(L, R)FLIP(L,R) means to flip all bulbs xxx such that L≤x≤RL \le…
Problem D. Digits 题目连接: http://codeforces.com/gym/100531/attachments Description Little Petya likes integers. Recently he has learned about different properties of sums of number's digits. For example, if the sum of number's digits is divisible by 9,…
POJ 1222 EXTENDED LIGHTS OUT 今天真是完美的一天,这是我在poj上的100A,留个纪念,马上就要期中考试了,可能后面几周刷题就没这么快了,不管怎样,为下一个200A奋斗, 这个题是大白上的牛翻转颜色的题(P153)的弱化版,典型的开关问题; /* * Created: 2016年04月05日 22时28分26秒 星期二 * Author: Akrusher * */ #include <cstdio> #include <cstdlib> #includ…
两种方法翻转一个整数.顺序翻转和递归翻转 这里没考虑overflow的情况 递归的作用是使得反向处理.即从递归栈的最低端開始处理.通过绘图可得. 假设是rec(num/10): 12345 1234 123 12 1         <-- 递归使得这个最先处理 package recursion; public class Reverse_digits_of_a_number { public static void main(String[] args) { int num = 123; S…
题意:给定一个数字,问你找 n 个数,使得这 n 个数各位数字之和都相等,并且和最小. 析:暴力,去枚举和是 1 2 3...,然后去选择最小的. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include <…