摘要:
class Solution: def coinChange(self, coins: List[int], amount: int) -> int: dp = [float('inf')] * (amount + 1) dp[0] = 0 for coin in coins: for x in r 阅读全文
摘要:
from functools import lru_cache @lru_cache(maxsize=None) # 加在函数定义前 def lcm(a, b): return (a * b) // math.gcd(a, b) 简单的缓存 import time def timer(func): 阅读全文
摘要:
#include<bits/stdc++.h> using namespace std; int n; int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int lcm(int a, int b) { return (a / g 阅读全文
摘要:
蓝桥杯国赛 from math import sqrt inf = float('inf') n, mx = map(int,input().split()) dot=[] for i in range(n): x,y=map(int,input().split()) dot.append((x,y 阅读全文
摘要:
#include<bits/stdc++.h> using namespace std; int main() { int a[6]={1,2,2,3,4,5}; //方法一 vector<int>b(a,a+6);//使用unique需保证已经排好序 b.erase(unique(b.begin( 阅读全文
摘要:
#include<bits/stdc++.h> #pragma GCC optimize(2) #define ll long long using namespace std; ll n,m;ll a[1000001];ll tree[1000001];ll tag[1000001]; int t 阅读全文
摘要:
吊坠 import os import sys from collections import defaultdict # 请在此输入您的代码 n,m=map(int,input().split()) l=[] cnt=0 for i in range(n): a=input() a=a+a d=d 阅读全文