結果

問題 No.305 鍵(2)
ユーザー sggkshio
提出日時 2018-12-26 22:43:41
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 1,031 bytes
コンパイル時間 887 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 25,604 KB
平均クエリ数 1.00
最終ジャッジ日時 2024-07-16 16:32:34
合計ジャッジ時間 7,156 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 13
権限があれば一括ダウンロードができます

ソースコード

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;
		cin >> p;
		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