当前位置:网站首页>Syntax basics (variables, input and output, expressions and sequential statements)
Syntax basics (variables, input and output, expressions and sequential statements)
2022-08-05 02:44:00 【attack siege lion】
作者:进击攻城狮
个人主页:欢迎访问我的主页
首发时间:2022年8月4日星期四
订阅专栏:刷题
个人信条:星光不问赶路人,岁月不负有心人.
如果文章有错误,欢迎在评论区指正.
支持我:点赞+收藏️+留言


文章目录
654.时间转换
Read an integer value,It is the duration of an event in the factory(以秒为单位),Please convert it to hours:分钟:秒来表示.
输入格式
输入一个整数 NN.
输出格式
Output the converted time representation,格式为 hours:minutes:seconds.
数据范围
1≤N≤10000001≤N≤1000000
输入样例:
556
输出样例:
0:9:16
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int x,y,z;
x=n/3600;
y=n%3600/60;
z=n%3600%60;
cout<<x<<':'<<y<<':'<<z<<endl;
return 0;
}
605. 简单乘积
读取两个整数值.
在此之后,计算它们的乘积并将结果存储在名为 PROD 的变量中.
输出结果如下例所示.
输入格式
共两行,每行包含一个整数.
输出格式
输出格式为 PROD = X,其中 XX 为乘积结果.
数据范围
输入的两个整数的绝对值均不超过 1000010000.
输入样例:
3
9
输出样例:
PROD = 27
#include <stdio.h>
#include <string.h>
const int N = 10010;
int a, n;
int tr[N];
int lowbit(int x)
{
return x & -x;
}
void add(int x, int c)
{
for (int i = x; i <= n; i += lowbit(i))
tr[i] += c;
}
int sum(int x)
{
int res = 0;
for (int i = x; i; i -= lowbit(i))
res += tr[i];
return res;
}
int main()
{
scanf("%d %d", &a, &n);
printf("PROD = ");
if (n < 0) n = -n, a = -a;
for (int i = 1; i <= n; i ++ )
add(i, a);
printf("%d", sum(n));
return 0;
}
611.简单计算
Given the product numbers of your two products,Product quantity and product unit price.
Please calculate how much it will cost to buy both products.
输入格式
输入共两行.
Each line contains two integers and one floating point number,Indicates the product number of one of the products,Product quantity and product unit price.
输出格式
输出格式为 VALOR A PAGAR: R$ X,其中 XX total product value,保留两位小数.
数据范围
1≤产品编号,产品数量≤100001≤产品编号,产品数量≤10000,
1.00≤产品单价≤10000.001.00≤产品单价≤10000.00
输入样例:
12 1 5.30
16 2 5.10
输出样例:
VALOR A PAGAR: R$ 15.50
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int a,b,c,d;
double e,f;
cin>>a>>b>>e>>c>>d>>f;
printf("VALOR A PAGAR: R$ %.2lf",b*e+d*f);
}
612.球的体积
给定你一个球体的半径 RR,请你计算球体的体积.
计算球体的公式为 V=(4/3)∗π∗R3V=(4/3)∗π∗R3.
ππ 取 3.141593.14159.
注意:有些语言中 (4/3)(4/3) 无法得到 1.3333…1.3333…,建议在公式中使用 (4/3.0)(4/3.0).
输入格式
输入一个整数 RR.
输出格式
输出格式为 VOLUME = X,其中 XX 为球体的体积,结果保留三位小数.
数据范围
1≤R≤20001≤R≤2000
输入样例:
3
输出样例:
VOLUME = 113.097
#include<iostream>
using namespace std;
int main(){
double PI=3.14159;
int r;
cin>>r;
printf("VOLUME = %.3lf",4/3.0*PI*r*r*r);
return 0;
}
1 学如逆水行舟,不进则退
边栏推荐
- private封装
- 01 [Foreword Basic Use Core Concepts]
- Semi-Decentralized Federated Learning for Cooperative D2D Local Model Aggregation
- mysql没法Execute 大拿们求解
- Lexicon - the maximum depth of a binary tree
- The design idea of DMicro, the Go microservice development framework
- LeetCode使用最小花费爬楼梯----dp问题
- C student management system Insert the student node at the specified location
- 后期学习计划
- Review 51 MCU
猜你喜欢
随机推荐
多线程(2)
lua学习
【 2 】 OpenCV image processing: basic knowledge of OpenCV
你要的七夕文案,已为您整理好!
【C语言】详解栈和队列(定义、销毁、数据的操作)
1484. 按日期分组销售产品
1667. Fix names in tables
Programmer's Tanabata Romantic Moment
dmp(dump)转储文件
QT MV\MVC结构
HDU 1114:Piggy-Bank ← 完全背包问题
DAY23: Command Execution & Code Execution Vulnerability
【LeetCode刷题】-数之和专题(待补充更多题目)
leetcode 15
2022-08-04:输入:去重数组arr,里面的数只包含0~9。limit,一个数字。 返回:要求比limit小的情况下,能够用arr拼出来的最大数字。 来自字节。
PostgreSQL数据库 用navicat 打开表结构的时候报错 cannot update secondarysnapshot during a parallel operation 怎么解决?
蚁剑高级模块开发
torch.roll()
倒计时 2 天|云原生 Meetup 广州站,等你来!
RAID磁盘阵列








![[C language] Detailed explanation of stacks and queues (define, destroy, and data operations)](/img/7b/8b3f1e4f0000aa34fc1f8fff485765.png)
