- 博客(246)
- 收藏
- 关注
原创 Codeforces 57C Array
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstdio>#include <math.h>#include <string>#include <algorithm>#include <vector>#define ll long lo...
2019-04-04 12:53:56
186
原创 Codeforces 295A Greg and Array
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstdio>#include <math.h>#include <string>#include <algorithm>#include <vector>using namespace s...
2019-04-03 18:45:40
175
原创 Codeforces 1143A The Doors
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstdio>#include <math.h>#include <string>#include <algorithm>#include <vector>using namespace s...
2019-04-02 09:09:29
292
原创 Codeforces 931A Friends Meeting
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstdio>#include <math.h>#include <string>#include <algorithm>#include <vector>using namespace s...
2019-04-01 10:35:54
161
原创 Leetcode 292 Nim Game
class Solution { public boolean canWinNim(int n) { if(n%4==0){ return false; } else{ return true; } }}
2019-04-01 10:18:19
111
原创 Codeforces 976A Minimum Binary Number
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstdio>#include <math.h>#include <string>#include <algorithm>#include <vector>using namespace s...
2019-03-31 17:29:52
168
原创 Leetcode 389 Find the Difference
class Solution { public char findTheDifference(String s, String t) { char[] ch1 = s.toCharArray(); char[] ch2 = t.toCharArray(); int cnt1=0; int cnt2=0; fo...
2019-03-31 17:19:45
96
原创 Codeforces 1028A Find Square
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstdio>#include <math.h>#include <string>#include <algorithm>#include <vector>using namespace s...
2019-03-30 15:40:01
129
原创 Leetcode 590 N-ary Tree Postorder Traversal
/*// Definition for a Node.class Node { public int val; public List<Node> children; public Node() {} public Node(int _val,List<Node> _children) { val = _val; ...
2019-03-30 14:56:52
112
原创 Codeforces 629A Far Relative’s Birthday Cake
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstdio>#include <math.h>#include <string>#include <algorithm>#include <vector>using namespace s...
2019-03-29 09:31:56
181
原创 Leetcode 182 Duplicate Emails
select Email from Person group by Email having count(*) > 1;
2019-03-29 08:56:26
134
原创 Codeforces 1131A Sea Battle
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstdio>#include <math.h>#include <string>#include <algorithm>#include <vector>using namespace s...
2019-03-28 11:24:58
166
原创 Leetcode 494 Target Sum
class Solution { int ans=0; public int findTargetSumWays(int[] nums, int S) { if (nums == null || nums.length == 0) return ans; dfs(nums, S, 0); return ans; } ...
2019-03-28 10:48:10
88
原创 Leetcode 589 N-ary Tree Preorder Traversal
/*// Definition for a Node.class Node { public int val; public List<Node> children; public Node() {} public Node(int _val,List<Node> _children) { val = _val; ...
2019-03-27 11:04:53
102
原创 Codeforces 92A Chips
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstdio>#include <math.h>#include <string>#include <algorithm>#include <vector>using namespace s...
2019-03-27 10:33:05
196
原创 Codeforces 1009A Game Shopping
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstdio>#include <math.h>#include <string>#include <algorithm>#include <vector>using namespace s...
2019-03-26 08:46:42
146
原创 Leetcode 985 Sum of Even Numbers After Queries
class Solution { public int[] sumEvenAfterQueries(int[] A, int[][] queries) { int len_A=A.length; int len_R=queries.length; int len_C=queries[0].length; int cnt=0;...
2019-03-26 08:39:28
113
原创 Codeforces 262A Roma and Lucky Numbers
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstdio>#include <math.h>#include <string>#include <algorithm>#include <vector>using namespace s...
2019-03-25 10:33:35
226
原创 Leetcode 922 Sort Array By Parity II
class Solution { public int[] sortArrayByParityII(int[] A) { int el=0; int ol=1; int len=A.length; int[] ans=new int[len]; for(int i=0;i<len;++i){ ...
2019-03-25 10:17:37
129
原创 Leetcode 700 Search in a Binary Search Tree
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { pub...
2019-03-24 20:21:41
109
原创 Codeforces 939A Love Triangle
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstdio>#include <math.h>#include <string>#include <algorithm>#include <vector>using namespace s...
2019-03-24 18:54:03
162
原创 Codeforces 1139A Even Substrings
#include <bits/stdc++.h>using namespace std; #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);#define endl "\n"#define int long longint n, ans = 0;string s;int32_t main()...
2019-03-23 12:28:06
137
原创 Leetcode 933 Number of Recent Calls
class RecentCounter { Queue<Integer> q; public RecentCounter() { q = new LinkedList(); } public int ping(int t) { q.add(t); while (q.peek() < t - 300...
2019-03-23 12:08:50
110
原创 Leetcode 852 Peak Index in a Mountain Array
class Solution { public int peakIndexInMountainArray(int[] A) { int ans=0; int len=A.length; for(int i=1;i<len-1;++i){ if((A[i]>A[i-1])&&(A[i]>...
2019-03-22 09:18:29
88
原创 Codeforces 898A Rounding
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstdio>#include <math.h>#include <string>#include <algorithm>#include <vector>using namespace s...
2019-03-22 09:11:46
167
原创 Leetcode 980 Unique Paths III
class Solution { int ans=0; int sx,sy,ex,ey; int cnt=1; public int uniquePathsIII(int[][] grid) { int len1=grid.length; int len2=grid[0].length; for(int i=0;i&...
2019-03-21 14:48:38
137
原创 Codeforces 937A Olympiad
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstdio>#include <math.h>#include <string>#include <algorithm>#include <vector>using namespace s...
2019-03-21 14:23:13
116
原创 Leetcode 728 Self Dividing Numbers
class Solution { public List<Integer> selfDividingNumbers(int left, int right) { List<Integer> ans=new ArrayList<Integer>(); for(int i=left;i<=right;++i){ ...
2019-03-20 08:35:07
108
原创 Codeforces 946A Partition
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstdio>#include <math.h>#include <string>#include <algorithm>#include <vector>using namespace s...
2019-03-20 08:31:04
149
原创 Codeforces 609A USB Flash Drives
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstdio>#include <math.h>#include <string>#include <algorithm>#include <vector>using namespace s...
2019-03-19 19:40:38
149
原创 Leetcode 965 Univalued Binary Tree
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { pub...
2019-03-19 19:23:43
69
原创 Leetcode 53 Maximum Subarray
class Solution { public int maxSubArray(int[] nums) { int len=nums.length; int[] dp =new int[len]; dp[0]=nums[0]; int ans=dp[0]; for(int i=1;i<len;++i){...
2019-03-18 11:08:49
76
原创 Codeforces 265A Colorful Stones (Simplified Edition)
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstdio>#include <math.h>#include <string>#include <algorithm>#include <vector>using namespace s...
2019-03-18 10:37:21
283
原创 Leetcode 617 Merge Two Binary Trees
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { pub...
2019-03-17 14:58:55
77
原创 Codeforces 1061A Coins
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstdio>#include <math.h>#include <string>#include <algorithm>#include <vector>using namespace s...
2019-03-17 14:29:55
115
原创 Codeforces 1092A Uniform String
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstdio>#include <math.h>#include <string>#include <algorithm>#include <vector>using namespace s...
2019-03-16 11:50:41
155
原创 Leetcode 944 Delete Columns to Make Sorted
class Solution { public int minDeletionSize(String[] A) { int row=A.length; int col=A[0].length(); int ans=0; for(int i=0;i<col;++i){ for(int j=1;j&...
2019-03-16 11:33:28
90
原创 Leetcode 942 DI String Match
class Solution { public int[] diStringMatch(String S) { int end=S.length(); int[] ans=new int[end+1]; int begin=0; int len=end; char[] ch=S.toCharArray();...
2019-03-15 01:11:52
78
原创 Codeforces 1088A Ehab and another construction problem
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstdio>#include <math.h>#include <string>#include <algorithm>#include <vector>using namespace s...
2019-03-15 01:06:24
201
原创 Leetcode 657 Robot Return to Origin
class Solution { public boolean judgeCircle(String moves) { int lcnt=0; int rcnt=0; int ucnt=0; int dcnt=0; char[] ch=moves.toCharArray(); int len=...
2019-03-14 09:23:49
83
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人