답안 #536422

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
536422 2022-03-13T09:41:03 Z idas ASM (LMIO18_asm) C++11
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr)
#define FOR(i, begin, end) for(int i = (begin); i < (end); i++)
#define TSTS int ttt; cin >> ttt; while(ttt--) solve()
#define all(x) (x).begin(), (x).end()
#define le(vec) vec[vec.size()-1]
#define sz(x) ((int)((x).size()))
#define pb push_back
#define s second
#define f first

using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<long double, long double> pdd;

const int INF=1e9, MOD=1e9+7, mod=998244353;
const ll LINF=1e13;

void setIO()
{
    FAST_IO;
}

void setIO(string s)
{
    FAST_IO;
    freopen((s+".in").c_str(), "r", stdin);
    freopen((s+".out").c_str(), "w", stdout);
}

const int N=60;

int n;
string a[N], b[N];

int main()
{
    setIO();
    cin >> n;
    FOR(i, 0, n) cin >> a[i] >> b[i];
    
    if(n==1){
        if(a[i]>b[i]){
            cout << -1;
        }
        else if(a[i]==b[i]){
            cout << 1 << "\n print";
        }
        else{
            cout << 2 << "\n add" << b[i]-a[i] << "\n print";
        }
        return 0;
    }
}

Compilation message

asm.cpp: In function 'int main()':
asm.cpp:48:14: error: 'i' was not declared in this scope
   48 |         if(a[i]>b[i]){
      |              ^
asm.cpp: In function 'void setIO(std::string)':
asm.cpp:32:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |     freopen((s+".in").c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
asm.cpp:33:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |     freopen((s+".out").c_str(), "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~