/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Wrong Answer 1ms 488.0 KiB
#3 Wrong Answer 1ms 532.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;
int convert_to_int(char x){
    if(x == '1')
        return 1;
    else if(x == '2'){
        return 2;
    }
    else if(x == '3'){
        return 3;
    }
    else if(x == '4'){
        return 4;
    }
    else if(x == '5'){
        return 5;
    }
    else if(x == '6'){
        return 6;
    }
    else if(x == '7'){
        return 7;
    }
    else if(x == '8'){
        return 8;
    }
    else if(x == '9'){
        return 9;
    }
}
int main(){
    string s;
    getline(cin , s);
    char a, b;
    a = *s.begin();
    b = s[2];
    int x = convert_to_int(a), y = convert_to_int(b);
    int n;
    cin >> n;
    int arr[n];
    arr[0] = x;
    arr[1] = y;
    int sum = 0;
    int dif = arr[1] - arr[0];
    for(int i = 2; i < n; i++){
        arr[i] = dif + arr[i-1];
    }
    for(int i = 0; i < n; i++){
        sum += arr[i];
    }
    cout << sum << endl;
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1231 Busy Friend
Contest
LUCC Presents Kick & Code Intra LU Programming Contest
Language
C++11 (G++ 13.2.0)
Submit At
2025-09-01 07:09:50
Judged At
2025-09-01 07:09:50
Judged By
Score
10
Total Time
1ms
Peak Memory
532.0 KiB