pat1006

吊儿郎当地正经着 吊儿郎当地正经着     2022-08-21     756

关键词:

1006. 换个格式输出整数 (15)

时间限制
400 ms
内存限制
65536 kB
代码长度限制
8000 B
判题程序
Standard
作者
CHEN, Yue

让我们用字母B来表示“百”、字母S表示“十”,用“12...n”来表示个位数字n(<10),换个格式来输出任一个不超过3位的正整数。例如234应该被输出为BBSSS1234,因为它有2个“百”、3个“十”、以及个位的4。

输入格式:每个测试输入包含1个测试用例,给出正整数n(<1000)。

输出格式:每个测试用例的输出占一行,用规定的格式输出n。

输入样例1:
234
输出样例1:
BBSSS1234
输入样例2:
23
输出样例2:
SS123
package com.lwh.agrithmatic.paractice;
import java.util.Scanner;
public class Practise6 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        int a=n/100;
        int b=n%100;
        int c=b/10;
        int d=b%10;
        String result="";
        if(a>0||b>0){//三位数
            for(int i=0;i<a;i++){
                result+="B";
            }
            for(int i=0;i<c;i++){
                result+="S";
            }
            for(int i=1;i<d+1;i++){
                result+=i;
            }
        }else{
            for(int i=1;i<d+1;i++){
                result+=i;
            }
        }
        System.out.println(result);
    }

}

 

1006.signinandsignout(25)—pat甲级

Atthebeginningofeveryday,thefirstpersonwhosignsinthecomputerroomwillunlockthedoor,andthelastonewhosignsoutwilllockthedoor.Giventherecordsofsigningin‘sandout‘s,youaresupposedtofindtheoneswhohaveunlocke 查看详情

pat1006

1006.换个格式输出整数(15)时间限制400ms内存限制65536kB代码长度限制8000B判题程序Standard作者CHEN,Yue让我们用字母B来表示“百”、字母S表示“十”,用“12...n”来表示个位数字n(<10),换个格式来输出任一个不超过3位的正整数... 查看详情

pat甲级1006signinandsignout

1#include<iostream>2#include<cstdio>3#include<cstring>4#include<algorithm>56usingnamespacestd;7structoi{8stringname;9inth1,m1,j1;10inth2,m2,j2;11};12intbijiao1(oix,oiy)13{14if( 查看详情

pat乙级1006(代码片段)

1006换个格式输出整数(15分) 让我们用字母B来表示“百”、字母S表示“十”,用12...n来表示不为零的个位数字n(<10),换个格式来输出任一个不超过3位的正整数。例如234应该被输出为BBSSS1234,因为它有2个&ldqu... 查看详情

java1006换个格式输出整数(15分)pat乙级pat(basiclevel)practice(中文)(代码片段)

你是最棒的前言题目:1006换个格式输出整数(15分)代码前言学得越多,不会得越多种一颗树的最佳时间是十年前,其次就是现在pat所有题解代码都会陆续上传到Github,请好兄弟们自行下载:https://github.com/233zzh/P... 查看详情

pat(basiclevel)1006(代码片段)

1#include<iostream>23usingnamespacestd;45intmain()67intn;8cin>>n;910if(n<10)11for(inti=1;i<=n;i++)12cout<<i;1314elseif(n<100&&n>10)15inti=n/10;16intj=n%10;17f 查看详情

pat1006换个格式输出整数

1006.换个格式输出整数(15)让我们用字母B来表示“百”、字母S表示“十”,用“12...n”来表示个位数字n(<10),换个格式来输出任一个不超过3位的正整数。例如234应该被输出为BBSSS1234,因为它有2个“百”、3个“十”、以及个... 查看详情

(学习英语)pat甲级第六题--1006signinandsignout(代码片段)

文章目录题目题目翻译解题思路解题代码题目OJ平台题目翻译单词积累signin登入signout登出题目描述Atthebeginningofeveryday,thefirstpersonwhosignsinthecomputerroomwillunlockthedoor,andthelastonewhosignsoutwilllockthedoor.Giventherecordsofsigningi 查看详情

pat1006换个格式输出整数(代码片段)

https://pintia.cn/problem-sets/994805260223102976/problems/994805318855278592 让我们用字母B来表示“百”、字母S表示“十”,用“12...n”来表示个位数字n(&lt10),换个格式来输出任一个不超过3位的正整数。例如234应该被输出为BBSSS1234,... 查看详情

pat乙级1006.换个格式输出整数(15)(代码片段)

1006.换个格式输出整数(15)让我们用字母B来表示“百”、字母S表示“十”,用“12…n”来表示个位数字n(<10),换个格式来输出任一个不超过3位的正整数。例如234应该被输出为BBSSS1234,因为它有2个“... 查看详情

pat甲题题解-1006.signinandsignout(25)-找最小最大

判断哪个人最早到,哪个人最晚走水,就是找最大值最小值#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<string.h>usingnamespacestd;intm;charunlock[20],lock[20];charstart 查看详情

pat乙级1006.换个格式输出整数(15)

让我们用字母B来表示“百”、字母S表示“十”,用“12...n”来表示个位数字n(<10),换个格式来输出任一个不超过3位的正整数。例如234应该被输出为BBSSS1234,因为它有2个“百”、3个“十”、... 查看详情

pat1006.换个格式输出整数(15)

让我们用字母B来表示“百”、字母S表示“十”,用“12...n”来表示个位数字n(<10),换个格式来输出任一个不超过3位的正整数。例如234应该被输出为BBSSS1234,因为它有2个“百”、3个“十”、以及个位的4。输入格式:每个... 查看详情

[pat乙级]practise1006换个格式输出整数(代码片段)

PAT(BasicLevel)Practice(中文)10061006换个格式输出整数让我们用字母B来表示“百”、字母S表示“十”,用12...n来表示不为零的个位数字n(<10),换个格式来输出任一个不超过3位的正整数。例如234应该被输出为BBSSS1234,因为它有2... 查看详情

pat乙级水题1006.换个格式输出整数(15)

1#include<iostream>2usingnamespacestd;3intmain()4{5intn;6cin>>n;7intg=0,s=0,b=0;8910for(inti=0;i<10;i++){11for(intj=0;j<10;j++){12for(intk=0;k<10;k++){13if(k==n){14g=k;15break;16} 查看详情

pat-乙级-1006换个格式输出整数(代码片段)

让我们用字母 B 来表示“百”、字母 S 表示“十”,用 12...n 来表示不为零的个位数字 n(<),换个格式来输出任一个不超过3位的正整数。例如 234 应该被输出为 BBSSS1234,因为它有2个“百... 查看详情

pat字符串处理题---1006换个格式输出整数(15分)(代码片段)

1006换个格式输出整数(15分)#include<iostream>#include<string>#include<cstdio>usingnamespacestd;intmain() intn;cin>>n; strings=to_string(n); if(s.length()==3) for(inti=1;i<=s[0]-‘0‘; 查看详情

pat乙级——1006部分a+b(15)

题目链接:​​部分A+B(15)​​题目描述正整数A的“DA(为1位整数)部分”定义为由A中所有DA组成的新整数PA。例如:给定A=3862767,DA=6,则A的“6部分”PA是66,因为A中有2个6。现给定A、DA、B、DB,请编写程序计算PA+PB。输入描述:... 查看详情