随笔分类 -  思考题

个人觉得需要仔细想下的题目
摘要:写一个函数,求两个整数之和,要求在函数体内不得使用+、-、*、/四则运算符号。 分析:只能用 与或 运算符 public class Solution { public int Add(int num1,int num2) { while( num2!=0 ){ int sum = num1 ^ n 阅读全文
posted @ 2020-02-16 23:07 Xzavieru 阅读(80) 评论(0) 推荐(0)
摘要:题目描述 求1+2+3+...+n,要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)。 public int Sum_Solution(int n) { int sum = n; (sum!=0) && ((sum += Sum_So 阅读全文
posted @ 2020-02-16 23:05 Xzavieru 阅读(124) 评论(0) 推荐(0)
摘要:D. Anton and Chess time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output D. Anton and Chess ti 阅读全文
posted @ 2018-08-10 00:34 Xzavieru 阅读(184) 评论(0) 推荐(0)
摘要:C. Anya and Smartphone time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output C. Anya and Smartp 阅读全文
posted @ 2018-08-10 00:29 Xzavieru 阅读(153) 评论(0) 推荐(0)
摘要:B. Mike and Feet time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output B. Mike and Feet time li 阅读全文
posted @ 2018-08-10 00:25 Xzavieru 阅读(209) 评论(0) 推荐(0)
摘要:题目大意就是问能分出几个使三个区间的和相等的分发 1 #include <algorithm> 2 #include <stack> 3 #include <istream> 4 #include <stdio.h> 5 #include <map> 6 #include <math.h> 7 #i 阅读全文
posted @ 2018-08-06 23:19 Xzavieru 阅读(245) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/276/problem/C 原题连接 解题说明:题目的意思是有若干对区间和的查询,问如何重组数组使查询结果的和最大。 我的解法就是将对应的频率排序之后在求(求频率那里需要点思维嘻嘻 直接贴代码了 #include <algorithm> # 阅读全文
posted @ 2018-08-05 22:53 Xzavieru 阅读(357) 评论(0) 推荐(0)
摘要:A. Escape from Stones time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A. Escape from Sto 阅读全文
posted @ 2018-07-29 23:23 Xzavieru 阅读(247) 评论(0) 推荐(0)
摘要:D. Roads not only in Berland time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output D. Roads no 阅读全文
posted @ 2018-07-29 23:05 Xzavieru 阅读(209) 评论(0) 推荐(0)