結果

問題 No.305 鍵(2)
ユーザー sggkshiosggkshio
提出日時 2018-12-26 22:46:25
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,037 bytes
コンパイル時間 651 ms
コンパイル使用メモリ 86,092 KB
実行使用メモリ 24,540 KB
平均クエリ数 1.00
最終ジャッジ日時 2023-09-23 16:40:39
合計ジャッジ時間 5,910 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>
#include <fstream>
#include <cassert>

using namespace std;

//#include<bits/stdc++.h>

string input(istream& is) {
	string ret;
	getline(is, ret);         //回答コードから受け取った文字列
	assert(ret.size() == 10); //長さは 10
	for (char c : ret) {        //数字のみかチェック
		assert('0' <= c && c <= '9');
	}
	return ret;
}

int main(int argc, char* argv[]) {

	ifstream ifs(argv[1]);
	string ans = input(ifs);

	while (1) {
		string p;
		p = input(cin);
		if (ans == p) {
			cout << p.size() << " unlocked" << endl;
			return 0;
		}
		int t = 0;
		for (int i = 0; i < p.size(); i++) {
			if (p[i] == ans[i])t++;

		}
		cout << t << " locked" << endl;
	}
	

	return 0;
}
0