結果
問題 | No.224 文字列変更(easy) |
ユーザー |
|
提出日時 | 2017-07-26 09:36:12 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 546 bytes |
コンパイル時間 | 1,293 ms |
コンパイル使用メモリ | 158,916 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-18 02:25:11 |
合計ジャッジ時間 | 1,800 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
コンパイルメッセージ
main.cpp: In function ‘int main(int, char**)’: main.cpp:14:11: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[1000]’ [-Wformat=] 14 | scanf("%s",&S); //文字列Sの入力 | ~^ ~~ | | | | | char (*)[1000] | char* main.cpp:15:11: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[1000]’ [-Wformat=] 15 | scanf("%s",&T); //文字列Tの入力 | ~^ ~~ | | | | | char (*)[1000] | char* main.cpp:13:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%d",&n); //長さの入力 | ~~~~~^~~~~~~~~ main.cpp:14:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | scanf("%s",&S); //文字列Sの入力 | ~~~~~^~~~~~~~~ main.cpp:15:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%s",&T); //文字列Tの入力 | ~~~~~^~~~~~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; int main(int argc, char **argv) { int i; //ループカウンタ int n; //長さ int count = 0; //操作回数のカウンタ char S[1000]; //文字列S char T[1000]; //文字列T scanf("%d",&n); //長さの入力 scanf("%s",&S); //文字列Sの入力 scanf("%s",&T); //文字列Tの入力 //操作回数の最小となる条件 for(i=0;i<n;i++) { if(S[i] != T[i]) { count++; } } printf("%d\n",count); return 0; }