結果

問題 No.1883 SLASH
ユーザー guy7ccguy7cc
提出日時 2022-03-25 21:25:12
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,849 bytes
コンパイル時間 641 ms
コンパイル使用メモリ 66,424 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 05:59:08
合計ジャッジ時間 1,311 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main()
{
    int num;
    cin >> num;
    int a, b, c;
    c = num % 10;
    num /= 10;
    b = num % 10;
    num /= 10;
    a = num % 10;

    int M, m;

    if (a >= b) {
        if (b >= c) {
            M = a;
            m = c;
        }
        else if (a >= c) {
            M = a;
            m = b;
        }
        else {
            M = c;
            m = b;
        }
    }
    else {
        if (a >= c) {
            M = b;
            m = c;
        }
        else if (b >= c) {
            M = b;
            m = a;
        }
        else {
            M = c;
            m = a;
        }
    }

    cout << (M - m) << endl;
    return 0;
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します
0