結果

問題 No.729 文字swap
ユーザー card_board01
提出日時 2018-09-24 17:27:16
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 468 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 26,752 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 12:05:40
合計ジャッジ時間 792 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <string.h>

/*
void swap(char *a, char *b) {
    char tmp;
    strcpy(tmp, *a);
    strcpy(*a, *b);
    strcpy(*b, tmp);
}
 */


int main(void) {
    
    int i, a, b;
    char str[10];
    char tmp;
    int length;
    
    length = sizeof(str) / sizeof(str[0]);
    
    scanf("%s", str);
    scanf("%d", &a);  scanf("%d", &b);
    
    tmp = str[a];
    str[a] = str[b];
    str[b] = tmp;
    
    printf("%s", str);
    
    return 0;
}
0