上一页 1 ··· 6 7 8 9 10 11 12 13 14 15 下一页
  2017年5月24日
摘要: #include #include #include #define max 20 using namespace std; int a[max][max]; int main() { int x, y, n, tot = 0; cin >> n; memset(a, 0, sizeof(a)); tot = a[x = 0][y = n - 1] = 1; while (tot= 0... 阅读全文
posted @ 2017-05-24 09:12 无惧风云 阅读(424) 评论(0) 推荐(0)
  2017年5月23日
摘要: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or 阅读全文
posted @ 2017-05-23 16:10 无惧风云 阅读(133) 评论(0) 推荐(0)
摘要: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl 阅读全文
posted @ 2017-05-23 15:53 无惧风云 阅读(156) 评论(0) 推荐(0)
摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 //1、水仙花数 9 //int main() 10 //{ 11 // for (int i = 100; i > a >> b >> c) 35 // { ... 阅读全文
posted @ 2017-05-23 11:15 无惧风云 阅读(249) 评论(0) 推荐(0)
  2017年5月22日
摘要: 输入n,计算S=1!+2!+3!+…+n!的末6位(不含前导0)。 n≤106,n!表示前n个正整数之积。样例输入:10样例输出:37913 这道题开始的时候,求末六位,我就简单的一位一位的求,但看到结果,我发现原来这么简单,还是自己练的少。但是上述代码还是有问题的,当n很大时,比如n=100时,就 阅读全文
posted @ 2017-05-22 16:05 无惧风云 阅读(848) 评论(0) 推荐(0)
摘要: 对于任意大于1的自然数n,若n为奇数,则将n变为3n+1,否则变为n的一半。经过若干次这样的变换,一定会使n变为1。 例如,3→10→5→16→8→4→2→1。输入n,输出变换的次数。 n≤109。样例输入:3 样例输出:7 对于样例可以正确输出结果,但是当输入987654321时,却不能输出正确结 阅读全文
posted @ 2017-05-22 15:14 无惧风云 阅读(309) 评论(0) 推荐(0)
  2017年5月19日
摘要: 1 #include 2 #include 3 using namespace std; 4 int main() 5 { 6 vector> vet; 7 for (int i = 0; i vet1; 10 for (int j = 0; j > x; 14 vet1.push_back(x); 15 }... 阅读全文
posted @ 2017-05-19 10:51 无惧风云 阅读(276) 评论(0) 推荐(0)
摘要: Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path betwe 阅读全文
posted @ 2017-05-19 09:30 无惧风云 阅读(194) 评论(0) 推荐(0)
  2017年5月18日
摘要: Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2. Note: 阅读全文
posted @ 2017-05-18 17:07 无惧风云 阅读(115) 评论(0) 推荐(0)
  2017年5月16日
摘要: Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction 阅读全文
posted @ 2017-05-16 14:58 无惧风云 阅读(121) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 13 14 15 下一页