csuoj 1392: Number Trick】的更多相关文章

http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1392 1392: Number Trick Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 200  Solved: 36[Submit][Status][Web Board] Description Input Output Sample Input 2.6 Sample Output 135 270 135135 270270 HINT 分析:…
http://122.207.68.93/OnlineJudge/problem.php?id=1299 第二个样例解释.. 3 6 3->4->6..两步.. 由此可以BFS也可以DP..但关键是要离线把100000内每个数的约数情况预先处理出来..否则会超时... Program: #include<iostream> #include<stdio.h> #include<cmath> #include<cstring> #include&l…
A.Planting Trees 排序+模拟 常识问题,将耗时排一个序,时间长的先种,每次判断更新最后一天的时间. 代码: #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #define Mod 1000000007 #define INT 2147483647 #define pi acos(-1.0)…
问题阐述会是这样的: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it. Follow up:Could you do it…
这个题我想到要用kmp找到循环节: 但是后面的我就不会做了: 看到题解才知道是字符串的最小表示: #include<cstdio> #include<cstring> #include<algorithm> #define maxn 100005 using namespace std; ]; int next[maxn]; void kmp(int n) { ; ;i<=n;i++) { &&s[i]!=s[j+])j=next[j]; ])++…
Single Number I : Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory? Solution: 解法不少,贴一种: class…
题意  给你一些牌  所有正面朝下放桌子上   你选一个起点    翻开那张牌   牌上的数字是几就向前走几步   J,Q,K 都是向前走10步  A向前走11步   知道向前走相应的步数后超过了终点   输入n m 和n个数   代表你以第m张牌为起点   依次掀开了n张牌就不能再掀了    然后相同的牌   Alice以1-10张牌中的随意一个为起点   求Alice最后的终点与你的终点相同的概率 c[i]表示第i张牌的面值   没被掀开的牌的面值都是未知的c[i]=0  可能为2-A中的随…
#1392 : War Chess 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 Rainbow loves to play kinds of War Chess games. There are many famous War Chess games such as "Biography of Cao Cao", "Anecdotes of Wagang Mountain", etc. In this problem, let's c…
Problem A. Magic Trick Small input6 points You have solved this input set.   Note: To advance to the next rounds, you will need to score 25 points. Solving just this problem will not give you enough points. Problem Recently you went to a magic show.…
Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water. Count the number of distinct island…