250:簡單題
class RunningAroundPark { public: int numberOfLap(int N, vectord) { int n=d.size(); int ans=1,last=-1; for(int i=0;i
500:找規律,簡單題class PotentialGeometricSequence { public: int numberOfSubsequences(vectord) { int n=d.size(); if(n==1) return 1; int ans=0,last=1,slope=d[1]-d[0]; for(int i=2;i
1000: 背包
typedef long long int LL; const LL mod=1000000007LL; class GoodSubset { public: int numberOfSubsets(int goodValue, vectord) { int n=d.size(); map mp; map ::reverse_iterator it; mp[1]=1; for(int i=0;i first*d[i]; if(goodValue%t==0) { mp[t]=(mp[t]+it->second)%mod; } } } mp[1]--; return mp[goodValue]; } };