提出 #58444369


ソースコード 拡げる

#if !__INCLUDE_LEVEL__
#include __FILE__



int main(){
    
    string T,S;cin>>S>>T;
    int i=0;
    while(1){
        if(T[i]!=S[i]){
            cout<<i+1<<endl;
            return 0;
        }
        else if(T.length() == i+1 && S.length()==i+1){
            cout<<0<<endl;
            return 0;
        }
        else if(T.length() == i+1 || S.length()==i+1){
            cout<<i+2<<endl;
            return 0;
        }
        i++;
    }

    return 0;
}

#else
#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
struct Init { Init() { ios::sync_with_stdio(0); cin.tie(0); cout << setprecision(13); } }init;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

#define rep(i, x, limit) for (int i = (int)x; i < (int)limit; i++)
#define REP(i, x, limit) for (int i = (int)x; i <= (int)limit; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define el '\n'
#define spa " "
#define Yes cout << "Yes" << el
#define No cout << "No" << el
#define YES cout << "YES" << el
#define NO cout << "NO" << el
#define eps (1e-10)
#define Equals(a,b) (fabs((a) - (b)) < eps )

const double pi = 3.141592653589793238;
const int inf = 1073741823;
const ll infl = 1LL << 60;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";

//配列の要素を空白区切りで出力 第二引数をtrueにすると改行区切り
template<class T> inline void print_vec(const vector<T>& v, bool split_line=false) {
    if(v.empty()){
        cout << "This vector is empty." << el;
        return;
    }
    for (int i = 0; i < v.size(); i++) {
        if(v[i]==inf || v[i]==infl) cout << 'x' << " \n"[split_line || i+1==(int)v.size()];
        else cout << v[i] << " \n"[split_line || i+1==(int)v.size()];
    }
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

#endif

提出情報

提出日時
問題 B - Unvarnished Report
ユーザ naok_000
言語 C++ 23 (gcc 12.2)
得点 200
コード長 2259 Byte
結果 AC
実行時間 1 ms
メモリ 3652 KiB

コンパイルエラー

Main.cpp: In function ‘int main()’:
Main.cpp:15:28: warning: comparison of integer expressions of different signedness: ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
   15 |         else if(T.length() == i+1 && S.length()==i+1){
      |                 ~~~~~~~~~~~^~~~~~
Main.cpp:15:48: warning: comparison of integer expressions of different signedness: ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
   15 |         else if(T.length() == i+1 && S.length()==i+1){
      |                                      ~~~~~~~~~~^~~~~
Main.cpp:19:28: warning: comparison of integer expressions of different signedness: ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
   19 |         else if(T.length() == i+1 || S.length()==i+1){
      |                 ~~~~~~~~~~~^~~~~~
Main.cpp:19:48: warning: comparison of integer expressions of different signedness: ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
   19 |         else if(T.length() == i+1 || S.length()==i+1){
      |                                      ~~~~~~~~~~^~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 25
セット名 テストケース
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 1 ms 3480 KiB
example_01.txt AC 1 ms 3464 KiB
example_02.txt AC 1 ms 3504 KiB
hand_00.txt AC 1 ms 3528 KiB
hand_01.txt AC 1 ms 3560 KiB
hand_02.txt AC 1 ms 3484 KiB
hand_03.txt AC 1 ms 3580 KiB
hand_04.txt AC 1 ms 3576 KiB
hand_05.txt AC 1 ms 3648 KiB
hand_06.txt AC 1 ms 3368 KiB
random_00.txt AC 1 ms 3564 KiB
random_01.txt AC 1 ms 3520 KiB
random_02.txt AC 1 ms 3520 KiB
random_03.txt AC 1 ms 3464 KiB
random_04.txt AC 1 ms 3452 KiB
random_05.txt AC 1 ms 3464 KiB
random_06.txt AC 1 ms 3464 KiB
random_07.txt AC 1 ms 3468 KiB
random_08.txt AC 1 ms 3524 KiB
random_09.txt AC 1 ms 3516 KiB
random_10.txt AC 1 ms 3528 KiB
random_11.txt AC 1 ms 3508 KiB
random_12.txt AC 1 ms 3644 KiB
random_13.txt AC 1 ms 3652 KiB
random_14.txt AC 1 ms 3528 KiB