40分求助(雾

P1001 A+B Problem

NO1P @ 2021-08-04 12:12:58

说句闲话:研究珂学的最好方法是

A了这道题

祝你们成功(滑稽

#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
int a, b;
void print(int ans) {
    printf("%d", ans);
}
void dfs(int &a, int &b, int ans, int tot) {
    if(tot==1) {
        print(ans);
        return;
    }
    vector<int> v;
    v.push_back(a), v.push_back(b);
    for(int i=1; i<=v.back(); i++) ans++;
    v.pop_back();
    for(int i=1; i<=v.back(); i++) ans++;
    dfs(a, b, ans, tot+1);
} 
int main() {
    scanf("%d%d", &a, &b);
    dfs(a, b, 0, 0);
    return 0;
}

40分

求救


by ud2_ @ 2021-08-04 12:19:02

v.pop_back();
for(int i=1; i<=v.back(); i++) ans++;

?


by churl_kind @ 2021-08-04 17:25:50

写那么长干嘛??

附上我的代码:

#include <bits/stdc++.h>
using namespace std;
int main() {
    int a,b;
    cin >> a >> b;
    cout << a+b;
    return 0;
}

by Super_Supper @ 2021-08-06 14:50:23

@云海行书

捞尸人


by churl_kind @ 2021-08-06 15:03:28

@sb_yyds

你才捞尸人……


by promise_ @ 2021-08-09 15:05:01

直接输出呗

#include <iostream>
using namespace std;
int main() {
    int a,b;
    cin >> a >> b;
    cout << a+b;
    return 0;
}
#include <cstdio>
using namespace std;
int main() {
    int a,b;
    cin >> a >> b;
    printf("%d",&a+b);
    return 0;
}

by soyaa_Jisoo @ 2021-08-13 23:00:08

直接这样不就行了吗:

#include<iostream>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    cout<<a+b<<endl;
    return 0;
}

那么烦干什么????


by mizimo @ 2021-10-06 16:53:21

dfs干什么???


by Colas_miao_ @ 2023-03-13 16:48:59

@promise_ ???printf和&???


|