This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
q = [0] * 5000000 | |
def solve(k, n): | |
ss = 0 | |
cnt = 0 | |
prev = 1983 | |
front = 0 | |
rear = 0 | |
for i in xrange(n): | |
num = prev % 10000 + 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
#define N_MAX 30 | |
static int C[N_MAX+1][N_MAX+1]; | |
int main(void) { | |
cout.sync_with_stdio(false); | |
cin.tie(nullptr); | |
C[0][0] = 1; | |
for (int i = 1; i <= N_MAX; ++i) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
public: | |
int threeSumClosest(vector<int>& nums, int target) { | |
if (nums.size() < 3) | |
return 0; | |
int ans = nums[0] + nums[1] + nums[2]; | |
sort(nums.begin(), nums.end()); | |
for (int i = 0, n = nums.size(); i < n; ++i) { | |
int lo = i + 1, hi = n - 1; | |
while (lo < hi) { |