牛客刷题篇

1. ⼩⻜机 00:00:00⸺00:08:53题号:BC2 链接: https://www.nowcoder.com/practice/5cd
9598f28f74521805d2069ce4a108a?
#include <cstdio>
#include <iostream>
using namespace std;

int main() 
{
    printf("     **\n");
    printf("     **\n");
    printf("************\n");
    printf("************\n");

    printf("    *  *\n");
    printf("    *  *\n");




}

2. ⼗六进制转⼗进制 00:08:54⸺00: 14:40题号:BC8 链接:
#include<bits/stdc++.h>
#include <cstdio>
int main()
{
    printf("%15d",0XABCDEF);
}

3. printf的返回值00:14:40⸺00:30:23 题号:(⽆) 链接: https://www.nowcoder.com/qu
estionTerminal/a19ef1d8e55c4cc786f11cbf6b2fde61
#include <iostream>
using namespace std;

int main() {
    
    int ret=printf("Hello world!");
    printf("\n%d",ret);
    

}

4. 学⽣基本信息输⼊输出00:30:23⸺00:44:58题号:BC11 链接: https://www.nowcoder.co
m/practice/eb49750ef0de47168c21761de086d97c?tpId=290&tqId=39799&ru=/exam/oj
#include<bits/stdc++.h>
int main()
{
    int s1,s2,s3;
    scanf("%d%d%d",&s1,&s2,&s3);
    printf("score1=%d,score2=%d,score3=%d",s1,s2,s3);
}

5. 判断字⺟00:44:59⸺00:58:30 题号:BC56 链接: https://www.nowcoder.com/practice/4
4d2d63103664913bc243d3836b4f341?tpId=290&tqId=39844&ru=/exam/oj
#define _CRT_SECURE_NO_WARNINGS 
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char a;
    cin >> a;
    if (isalpha(a))
    {
        cout << "YES";
    }
    else
        cout << "NO";
}

6. 字符⾦字塔 00:58:46⸺01:10:10题号:(⽆) 链接: https://www.nowcoder.com/questi
onTerminal/21af98d8836f4832af88713e28e7b858
#include <iostream>
using namespace std;
void space(int n)
{
    for(int i=0;i<n;i++)
    {
        cout<<" ";
    }
}
int main()
{
    char ch;
    cin>>ch;
    for(int i=5;i>=1;i--)
    {
        space(i-1);
        for(int j=i;j<=5;j++)
        {
         cout<<ch<<" ";
            
        }
        cout<<endl;
    }    
}
// 64 位输出请用 printf(\"%lld\")

7. ASCII码 01:10:21⸺01:18:05 题号:(⽆) 链接: https://www.nowcoder.com/question
Terminal/7a2311d15c824e4294c3c87c83070818
#include <iostream>
using namespace std;

int main() 
{
    printf("%c%c%c%c%c%c%c%c%c%c%c%c",73, 32, 99, 97, 110, 32, 100, 111, 32, 105, 116 , 33);    
    
}

// 64 位输出请用 printf(\"%lld\")

8. 出⽣⽇期输⼊输出 01:18:08⸺01:25:47题号:BC13 链接: https://www.nowcoder.com/
practice/4a4a9dd1edb6453ba4a0432319200743?tpId=290&tqId=39801&ru=/exam/oj
#include <cstdio>
#include <iostream>
using namespace std;

int main()
{
   int year,month,date;
   scanf("%4d%2d%2d",&year,&month,&date);
   printf("year=%04d\nmonth=%02d\ndate=%02d",year,month,date);
    
}
// 64 位输出请用 printf("%lld")

9. 2的n次⽅计算 01:25:47⸺01:36:44题号:BC31 链接: https://www.nowcoder.com/prac
tice/35a1e8b18658411388bc1672439de1d9?tpId=290&tqId=39819&ru=/exam/oj
#include <bits/stdc++.h>
using namespace std;

int main() 
{
   long n;
   cin>>n;
   long long ret=1;
   ret=ret << n;
   
    cout<<ret;
}

10. 按照格式输⼊并交换输出 01:37:23⸺01:41:28 题号:BC14 链接: https://www.nowcoder.c
om/practice/95eb723a3e854376a7eb6d116cc7d875?tpId=290&tqId=39802&ru=/exam/oj
#include <bits/stdc++.h>
#include <cstdio>
using namespace std;

void Swap(int& x,int& y)
{
    auto t=x;
    x=y;
    y=t;

}
int main() 
{
   int a,b;
   scanf("a=%d,b=%d",&a,&b);
   Swap(a, b);
   printf("a=%d,b=%d",a,b);
}

11. 字符转ASCⅡ码值01:41:34⸺01:43:19 题号:BC9 链接: https://www.nowcoder.com/pra
ctice/93f4d05a02d9468db424ed4316bfc8fd?tpId=290&tqId=39797&ru=/exam/oj
#include <iostream>
using namespace std;

int main() 
{
    char ch =0;
    cin>>ch;
    printf("%d",ch);
}
// 64 位输出请用 printf("%lld")

12. 计算表达式的值01:43:19⸺01:45:26 题号(⽆) 链接: https://www.nowcoder.com/qu
estionTerminal/fa652b3bcce84035827ea1ff2ccf24d3
#include <iostream>
using namespace std;

int main() {
    int a=40,c=212;
    auto ret=(-8+22)*a-10+c/2.0;
    cout<<ret;
}
// 64 位输出请用 printf(\"%lld\")

13. 计算带余除法 01:45:26⸺01:52:08 题号:BC26 链接: https://www.nowcoder.com/prac
tice/34d3911bf2fd48a285f6396e886a1259?tpId=290&tqId=39814&ru=/exam/oj
#include <iostream>
using namespace std;

int main() {
    int a,b;
    cin>>a>>b;
    cout<<a/b<<" "<<a%b;
}
// 64 位输出请用 printf("%lld")

 

  • 10
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值