ABC340(A-C)

A

#include
using namespace std;
int main()
{
  int a,b,d;
  cin>>a>>b>>d;
  while(a<=b){
    cout<

B

#include
using namespace std;
vector v;
int main()
{
  int n;
  int a,b;
  cin>>n;
  while(n--){
    cin>>a>>b;
    if(a==1)v.push_back(b);
    else cout<

C

#include
#define ll long long
using namespace std;
ll n;
map mp;
ll dfs(ll n){
    if(n<2)return 0;
    else{
        if(!mp[n]){
            long long tmp1 = dfs(n / 2), tmp2 = dfs(n - n / 2);
            if(n%2==0)mp[n]=tmp1*2+n;
            else mp[n]=tmp1+tmp2+n;
        }
        return mp[n];
    }
}
int main()
{
    cin>>n;
    cout<

记忆化搜索:dp+dfs

你可能感兴趣的:(c语言,算法,开发语言)