Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
88999 sh25_zhangyj 标记门牌号 C++ 通过 0 MS 252 KB 841 2026-05-22 14:41:47

Tests(1/1):


#include <iostream> #include <string> #include <map> using namespace std; map<char, char> flip = {{'0','0'}, {'1','1'}, {'6','9'}, {'8','8'}, {'9','6'}}; bool isConfusing(string door) { for (char c : door) { if (flip.find(c) == flip.end()) return false; } string flipped; for (int i = door.size()-1; i >= 0; i--) { flipped += flip[door[i]]; } return flipped == door; } int main() { int F, n; cin >> F >> n; int count = 0; for (int floor = 1; floor <= F; floor++) { for (int room = 1; room <= n; room++) { char door[10]; sprintf(door, "%d%02d", floor, room); if (isConfusing(string(door))) { count++; } } } cout << count << endl; return 0; }


测评信息: