提出 #73305001


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,a=0; cin>>n;
    string s[n];
    for(int i=0;i<n;i++)cin>>s[i];
    for(int i=0;i<n;i++){
        if(a<s[i].size())a=s[i].size();
    }
    for(int i=0;i<n;i++){
        int b=(a-s[i].size())/2;
        for(int j=0;j<b;j++)cout<<'.';
        cout<<s[i];
        for(int j=0;j<b;j++)cout<<'.';
        cout<<endl;
    }
}

提出情報

提出日時
問題 B - Center Alignment
ユーザ oja2828
言語 C++23 (GCC 15.2.0)
得点 200
コード長 405 Byte
結果 AC
実行時間 1 ms
メモリ 3624 KiB

コンパイルエラー

./Main.cpp: In function 'int main()':
./Main.cpp:8:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |         if(a<s[i].size())a=s[i].size();
      |            ~^~~~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 2
AC × 10
セット名 テストケース
Sample 00_sample_01.txt, 00_sample_02.txt
All 00_sample_01.txt, 00_sample_02.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 02_min_01.txt, 03_max_01.txt
ケース名 結果 実行時間 メモリ
00_sample_01.txt AC 1 ms 3616 KiB
00_sample_02.txt AC 1 ms 3548 KiB
01_random_01.txt AC 1 ms 3588 KiB
01_random_02.txt AC 1 ms 3524 KiB
01_random_03.txt AC 1 ms 3584 KiB
01_random_04.txt AC 1 ms 3516 KiB
01_random_05.txt AC 1 ms 3624 KiB
01_random_06.txt AC 1 ms 3548 KiB
02_min_01.txt AC 1 ms 3588 KiB
03_max_01.txt AC 1 ms 3452 KiB