南邮 OJ 1199 B_Conversions

B_Conversions

时间限制(普通/Java) :  1000 MS/ 3000 MS          运行内存限制 : 65536 KByte
总提交 : 47            测试通过 : 22 

比赛描述

Conversion between the metric and English measurement systems is relatively simple. Often, it involves either multiplying or dividing by a constant. You must write a program that converts between the following units:




输入

The first line of input contains a single integer N, (1 ≤ N ≤ 1000) which is the number of datasets that follow.

Each dataset consists of a single line of input containing a floating point (double precision) number, a space and the unit specification for the measurement to be converted. The unit specification is one of kg, lb, l, or g referring to kilograms, pounds, liters and gallons respectively.


输出

For each dataset, you should generate one line of output with the following values: The dataset number as a decimal integer (start counting at one), a space, and the appropriately converted value rounded to 4 decimal places, a space and the unit specification for the converted value.


样例输入

5
1 kg
2 l
7 lb
3.5 g
0 l

样例输出

1 2.2046 lb
2 0.5284 g
3 3.1752 kg
4 13.2489 l
5 0.0000 g

题目来源

Greater New York Region 2007


#include<iostream>
#include<iomanip>
#include<string>
using namespace std;

int main(){
	int N,i;
	double d;
	string s;
	cin>>N;
	cout<<fixed<<setprecision(4);
	for(i=1;i<=N;i++){
		cin>>d>>s;
		cout<<i<<' ';
		if("kg"==s){
			cout<<d*2.2046<<" lb"<<endl;
		}else if("lb"==s){
			cout<<d*0.4536<<" kg"<<endl;
		}else if("l"==s){
			cout<<d*0.2642<<" g"<<endl;
		}else if("g"==s){
			cout<<d*3.7854<<" l"<<endl;
		}
	}
}






引用是一段关于利用pwntools库对jarvisoj_level0进行攻击的代码。代码中使用了remote()方法建立了远程连接,并构造了一个payload来利用栈溢出漏洞,最终执行callsystem()函数来获取shell权限。引用也是类似的代码,只是连接的地址不同。引用是一篇关于pwntools基本用法的文章,并提供了一些常用的函数和方法。根据这些引用内容,可以得出结论,jarvisoj_level0是一个存在栈溢出漏洞的程序,可以通过构造特定的payload来执行系统调用函数,从而获取shell权限。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [jarvisoj_level0](https://blog.csdn.net/weixin_56301399/article/details/125919313)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [jarvisOJ-level0](https://blog.csdn.net/qq_35661990/article/details/82889103)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [jarvis oj---level0解题方法](https://blog.csdn.net/weixin_45427676/article/details/97272924)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值