- 博客(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 149
原创 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 146
原创 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 250
原创 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 130
原创 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 85
原创 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 129
原创 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 66
原创 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 91
原创 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 86
原创 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 129
原创 Leetcode 182 Duplicate Emails
select Email from Person group by Email having count(*) > 1;
2019-03-29 08:56:26 85
原创 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 135
原创 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 63
原创 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 74
原创 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 150
原创 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 109
原创 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 82
原创 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 189
原创 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 106
原创 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 82
原创 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 128
原创 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 103
原创 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 81
原创 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 60
原创 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 138
原创 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 111
原创 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 85
原创 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 78
原创 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 125
原创 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 120
原创 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 51
原创 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 53
原创 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 234
原创 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 51
原创 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 82
原创 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 128
原创 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 58
原创 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 55
原创 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 158
原创 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 52
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人