/ SeriousOJ /

Record Detail

Wrong Answer


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

Code

#include <bits/stdc++.h>
using namespace std;
long long convert_to_int(char x){
    for(long long i = 1; i < 100000000; i++){
        if(x == i){
            return i-48;
        }
    }
}
int main(){
    string s;
    getline(cin , s);
    char a, b;
    a = *s.begin();
    b = s[2];
    long long x = convert_to_int(a), y = convert_to_int(b);
    int n;
    cin >> n;
    long long arr[n];
    arr[0] = x;
    arr[1] = y;
    long long sum = 0;
    long long 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:22:34
Judged At
2025-09-01 07:22:34
Judged By
Score
10
Total Time
1ms
Peak Memory
788.0 KiB