转载请注明出处:http://blog.csdn.net/ns_code/article/details/27964027题目描写叙述:求1+2+3+...+n,要求不能使用乘除法、for、while、if、else、switch、case等keyword及条件推断语句(A?B:C)。输入:输入可能 ...
分类:
其他好文 时间:
2017-06-10 15:35:18
阅读次数:
160
Matrix Searching Time Limit: 10 Seconds Memory Limit: 32768 KB Given an n*n matrix A, whose entries Ai,j are integer numbers ( 1 <= i <= n, 1 <= j <= ...
分类:
其他好文 时间:
2017-05-24 10:07:54
阅读次数:
205
转载请注明出处:http://blog.csdn.net/ns_code/article/details/27964027题目描写叙述:求1+2+3+...+n,要求不能使用乘除法、for、while、if、else、switch、case等keyword及条件推断语句(A?B:C)。输入:输入可能 ...
分类:
其他好文 时间:
2017-05-21 12:49:48
阅读次数:
161
51nod 1831:小C的游戏 题目链接:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1831 题目大意:有堆大小为$n$的石子,每人每次可以从中取走一个或留下$d$($d|n$,$d$不为$1$或$n$)个石子,最后 ...
分类:
其他好文 时间:
2017-05-20 01:09:36
阅读次数:
117
Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, ...
分类:
编程语言 时间:
2017-05-18 11:30:00
阅读次数:
168
#include using namespace std; int D, N; int main() { while (scanf("%d%d", &D, &N)!=EOF) { int k = 1; for (int i = 0; i < D - 1; i++) { if (N % 2) { ..... ...
分类:
其他好文 时间:
2017-04-29 22:19:43
阅读次数:
161
要求: 不使用乘除法。for、while 、if、else、switch、case、以及A?B:C三元表达式 求1+2+3+...+n 此题思路有多种,能够用多态、构造函数、递归、和模板元。 我在看到此题时第一个想到的是模板元编程。 构造函数解决比較暴力,仅仅须要定义一个class 然后实例化这个类 ...
分类:
其他好文 时间:
2017-04-25 17:03:31
阅读次数:
161
求 1+2+...+n,要求不能使用乘除法、for、while、if、else、switch、case 等关键字以及条件判断语句 (A?B:C)。 ...
分类:
其他好文 时间:
2017-04-14 09:29:59
阅读次数:
140
题目:求1+2+3+...+n,要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)。 思路:一般题目这样要求就是要用位运算。。这里利用短路的特点。n==0时,res&(Sum_Solution(n-1))只执行前面的,作为递归出口 ...
分类:
其他好文 时间:
2017-04-11 09:58:09
阅读次数:
133