![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
暴力||模拟
文章平均质量分 72
别哔哔好伐
安静的coder
展开
-
hdu1172猜数字
#include /// ac #includeusing namespace std;int main(){ int a[200],n,b[200],i,i1,i2,c[200]; int f,k,ans; while(scanf("%d",&n)!=EOF,n) { for(i=1; i<=n; i++) sc原创 2014-11-10 19:25:15 · 529 阅读 · 0 评论 -
leetcode-258-Add Digits
Add DigitsGiven 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.原创 2015-08-31 13:19:39 · 583 阅读 · 0 评论 -
leetcode-155-Min Stack
Min Stack Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on top of t原创 2015-08-04 18:14:58 · 570 阅读 · 0 评论 -
leetcode-67-Add Binary
Add BinaryGiven two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".两字符串表示的2进制数。求它们的和。直接模拟,从最后一位开始每一位都相加,结果保存在栈中。class Solut原创 2015-08-03 18:41:59 · 522 阅读 · 0 评论 -
leetcode-225-Implement Stack using Queues
Implement Stack using Queues Implement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() --原创 2015-08-03 17:44:43 · 547 阅读 · 0 评论 -
leetcode-190-Reverse Bits
Reverse Bits Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represen原创 2015-08-01 22:34:58 · 502 阅读 · 0 评论 -
leetcode-168-Excel Sheet Column Title
Excel Sheet Column Title Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z原创 2015-07-29 12:21:07 · 564 阅读 · 0 评论 -
leetcode-202-Happy Number
Happy NumberWrite an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the numb原创 2015-07-25 23:08:29 · 653 阅读 · 0 评论 -
leetcode 46-Permutations and 47-Permutations II
PermutationsGiven a collection of numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1]原创 2015-07-09 20:22:06 · 765 阅读 · 0 评论 -
全排列
全排列暴力枚举,每次在数组中选一个数,能则继续选下一个,否则另找一个数。#include /// 排列#include#includeusing namespace std;void next(int n,int* a,int cur) ///1~n的全排列 cur为要填充的位置{ if(cur==n){ for(int i=0;i<n;i++)prin原创 2015-07-09 18:13:49 · 849 阅读 · 0 评论 -
uva 11059 Maximum Product
Problem D - Maximum ProductTime Limit: 1 secondGiven a sequence of integers S = {S1, S2, ..., Sn}, you should determine what is the value of the maximum positive product involving cons原创 2015-01-23 17:04:23 · 729 阅读 · 0 评论 -
uva 725 - Division
Division Write a program that finds and displays all pairs of 5-digit numbers that between them use the digits 0through 9 once each, such that the first number divided by the second is e原创 2015-01-23 16:17:03 · 570 阅读 · 0 评论 -
leetcode-232-Implement Queue using Stacks
Implement Queue using Stacks Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front of queue.pe原创 2015-08-03 17:29:45 · 372 阅读 · 0 评论