P5730
这道题莫名其妙的在本地能过可是洛谷上却0分,把WA的点下载下来之后发现我输出的和他要输出的明明一模一样,说明洛谷的评测有一些问题。我把getchar输入换成cin输入后就AC了,说明洛谷对getchar的处理和我本地VScode的处理不一样,总结就是下次慎用getchar这种啥都输入的东西。
WA-Code(AC-Code在后面)
#include <iostream>
#include <string>
using namespace std;
int n,num[105];
string no[10][5]={
"XXX","X.X","X.X","X.X","XXX",
"..X","..X","..X","..X","..X",
"XXX","..X","XXX","X..","XXX",
"XXX","..X","XXX","..X","XXX",
"X.X","X.X","XXX","..X","..X",
"XXX","X..","XXX","..X","XXX",
"XXX","X..","XXX","X.X","XXX",
"XXX","..X","..X","..X","..X",
"XXX","X.X","XXX","X.X","XXX",
"XXX","X.X","XXX","..X","XXX"
};
int main()
{
scanf("%d",&n);getchar();//while(getchar()==' ');
for(int i=1;i<=n;i++)num[i]=int(getchar()-'0');//while(getchar()==' ');
for(int i=0;i<5;i++)
{
for(int j=1;j<=n;j++)
{
cout<<no[num[j]][i];
if(j!=n)cout<<'.';
}
if(i!=4)cout<<endl;
}
cout<<endl;
return 0;
}
AC-Code
#include <iostream>
#include <string>
using namespace std;
int n,num[105];
string no[10][5]={
"XXX","X.X","X.X","X.X","XXX",
"..X","..X","..X","..X","..X",
"XXX","..X","XXX","X..","XXX",
"XXX","..X","XXX","..X","XXX",
"X.X","X.X","XXX","..X","..X",
"XXX","X..","XXX","..X","XXX",
"XXX","X..","XXX","X.X","XXX",
"XXX","..X","..X","..X","..X",
"XXX","X.X","XXX","X.X","XXX",
"XXX","X.X","XXX","..X","XXX"
};
int main()
{
scanf("%d",&n);
char c;
for(int i=1;i<=n;i++)
{
cin>>c;
num[i]=int(c-'0');
}
for(int i=0;i<5;i++)
{
for(int j=1;j<=n;j++)
{
cout<<no[num[j]][i];
if(j!=n)cout<<'.';
}
if(i!=4)cout<<endl;
}
cout<<endl;
return 0;
}
P5730的更多相关文章
- [打基础]OI/ACM基本功&一些小功能的实现&一些错误(持续更新)
基本功 前导0 如题,有时候需要把3输出成03这样子,可以调用 cout.width(x); ,x表示以几位,用 cout.fill(x); 来给出前导填充的内容,一般x以char的形式给出 例如可以 ...
随机推荐
- YOLO: Real-Time Object Detection 遇到的问题
YOLO: Real-Time Object Detection 官方介绍的方法安装好了yolo之后,然后使用命令: ./darknet detect cfg/yolov3.cfg yolov3.we ...
- VMware安装虚拟机详细步骤
在VMware中安装CentOS7 01.目录 CentOS7的下载 CentOS7的配置 CentOS7的安装 CentOS7的网络配置 自动获取IP 固定获取IP 02.安装前提 准备工作: 提前 ...
- 【Dotnet 工具箱】推荐一个 Flutter 和 .NET 开源的实时聊天 APP
1. 推荐一个 Flutter 和 .NET 开源的实时聊天 APP Heyy-chat-app Heyy-chat-app 是一个开源的聊天应用,使用 Flutter.Asp.Net Core We ...
- 使用容器快速在阿里云 ECS 多节点上搭建 Citus 12.1 集群
阿里云 ECS 机器节点 这里我们使用两台同一区域的 ECS 机器. 机器配置:2 核 2 G.(ps: 阿里云 99 元一年的活动) 一台安装 coordinator(协调器),这里内网 IP 为 ...
- Windows上安装jenkins
官网下载jenkins https://www.jenkins.io/zh/download/ 选择Windows版本下载,安装 注意,需要java11,17或21才能安装 java下载地址 htt ...
- TypeScript Vs JavaScript 区别
一.观察 1. JS 平常的复制类型 let val; val = 123; val = "123"; val = true; val = [1, 3, 5]; 注意点: 由于JS ...
- Java中ArrayList的遍历与删除元素方式总结
在Java编程中,我们经常需要对数据结构进行遍历操作,并根据业务需求删除部分元素.而数组列表(ArrayList)是集合类中的一种,它可以动态地添加和删除元素,非常适合在程序中使用.本篇博客将总结Ar ...
- [Python急救站]定时关机程序
收到朋友的请求,让我帮他做一个电脑关机程序,其实非常简单.代码如下: import tkinter as tk # 导入tkinter模块 from tkinter import ttk # 导入tt ...
- Python中的cls语法
在Python中,cls 是一个用于指代类本身的约定性名称,通常用作类方法(class method)中的第一个参数.cls 类似于 self,它是对类的引用,而不是对实例的引用.cls 通常在类 ...
- MySQL篇:第五章_详解DDL语言
DDL语句 库和表的管理 库的管理: 一.创建库 create database 库名 二.删除库 drop database 库名 表的管理: 1.创建表 CREATE TABLE IF NOT E ...