码迷,mamicode.com
首页 >  
搜索关键字:int    ( 143001个结果
UVA 146 ID Codes
求用这些字母的下一个排列是什么。直接使用C++ STL库里面的next_permutation#include#include#includeusing namespace std;int main(){ char s[1000]; while (~scanf("%s", s)) ...
分类:其他好文   时间:2015-04-16 07:58:45    阅读次数:184
UVA 131 The Psychic Poker Player
此题写起来有点烦躁,但思路并不难。枚举一下丢1,2,3,4,5张的所有情况,就可以出答案了。DFS。#includechar s1[6][3], s2[6][3];//输入int hand[6], deck[6];//输入点数的转换成数字int flag[6];//标记这张牌用不用 1表示用int ...
分类:其他好文   时间:2015-04-16 07:57:41    阅读次数:210
UVA 11205 The broken pedometer
只要用哪几列就可以使P行都不同。暴力DFS就可以了。#include#includeint n, p;//n列 p行int map[105][20];int flaglie[20];char s[105][20];int sum;void sou(int ans){ int i, c = 0,...
分类:其他好文   时间:2015-04-16 07:56:38    阅读次数:126
UVA 10167 Birthday Cake
直接暴力枚举即可#includeint main(){ int n, i, j, k; int x[1000], y[1000]; while (~scanf("%d", &n)) { if (n == 0) break; int sum1 = 0...
分类:其他好文   时间:2015-04-16 07:55:38    阅读次数:128
Search a 2D Matrix
这道题有两种解法,第一种最好想吧,2次两分法,第二种是维度变换详细解释refhttp://www.cnblogs.com/springfor/p/3857959.htmlpublic class Solution { public boolean searchMatrix(int[][] ma...
分类:其他好文   时间:2015-04-16 06:46:56    阅读次数:131
单链表排序
1.代码实现如下node* bubble(node* head, int len){ int nVal = 0; node* pCur=NULL; node* pNext=NULL; //外部循环为len for(int i=0; inext; //内部循环逐次减少 for...
分类:编程语言   时间:2015-04-16 06:45:27    阅读次数:166
Merge Sorted Array
题目链接https://leetcode.com/problems/merge-sorted-array/这道题是merge sort中merge的过程,有一个trick是从后往前merge,这样可以避免多余的数组操作class Solution {public: void merge(int...
分类:其他好文   时间:2015-04-16 06:44:10    阅读次数:121
c extern小结
extern 的作用是延深文件中变量或者函数的可访问性。主要对全局变量和全局函数其作用。下面是验证的代码: a.c: #include #include int value; //定义一个全局变量 void show() { printf("show something\n")...
分类:其他好文   时间:2015-04-16 06:42:20    阅读次数:123
Something about "for"
For语句引导了一个循环语句,格式for(;;),例for(int i=0;i<100;i++)。类似于if()括号的作用for()括号如同if()括号一样也是一个boolean型。int i=0第一个分号前面定义一个初始值;中间区域i<100定义一个执行条件,当i满足条件时执行;i++区域是i的执...
分类:其他好文   时间:2015-04-16 06:42:13    阅读次数:114
Remove Element
题目链接https://leetcode.com/problems/remove-element/这道题比较简单,为了维护这个leetcode系列的完整性,我依然把它加在这里,code如下class Solution {public: int removeElement(int A[], in...
分类:其他好文   时间:2015-04-16 06:42:02    阅读次数:109
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!