PTA 打印沙漏
2024-09-01 04:03:12
https://pintia.cn/problem-sets/17/problems/260
#include <bits/stdc++.h> using namespace std; int main()
{
int N;
char sign;
cin >> N >> sign;
int count = ;
while ( * count * count - <= N)
{
count++;
}
count--; for (int i = ; i < * count - ; i++)
{
for (int j = ; j < count - - abs(count - - i); j++)
{
printf(" ");
}
for (int j = ; j < * abs(count - - i) + ; j++)
{
printf("%c", sign);
}
printf("\n");
}
printf("%d", N - ( * count * count - ));
return ;
}
最新文章
- JQ实现判断iPhone、Android设备
- Windows下mysql忘记root密码的解决方法
- 输出国际象棋&;&;输出余弦曲线
- JavaScript list 去重复
- puppet 安装
- HDU 4292 Food 最大流
- 利用Qt制作一个helloworld
- 计算(a/b)%c
- KeyValuePair用法(转)
- linux实训
- cookie报错
- APIView源码简单分析图
- 消息摘要、哈希(hash)、加盐
- 五分钟带你走入MP
- 【Java】 剑指offer(56-2) 数组中唯一只出现一次的数字
- Mac实现远程服务器登录管理
- .Net Entity Framework Core 用 HasColumnType 配置浮点数精度
- Reset GitLab Root Password
- 《A First Course in Abstract Algebra with Applications》-chaper1-数论-棣莫弗定理
- 用Python开始机器学习(3:数据拟合与广义线性回归)
热门文章
- 使用PNG实现半透明的窗体(使用GDI+)
- QT5.7静态编译(使用VS2013与VS2015编译,XP可用,有详细configure脚本。VS下Qt插件的配置。编译选项加上-mp可以开启多线程编译,编译速度提高2倍以上)
- MJPhotoBrowser 用法
- 你真的懂printf么?
- VS让人纠结的Release和网站一键发布
- Verilog写一个对数计算模块Log2(x)
- 高并发 Nginx+Lua OpenResty系列(10)——商品详情页
- spring cloud 系列第3篇 —— ribbon 客户端负载均衡 (F版本)
- vue注意项
- CI框架使用(一)