北京理工大学复试上机--2001A
#include <iostream>
using namespace std;
int main() {
double x;
while(cin >> x) {
if(x >= && x < ) {
cout << 2.5 - x << endl;
}
else if(x >= && x < ) {
cout << - 1.5 * (x - ) * (x - ) << endl;
}
else if(x >= && x < ) {
cout << x / - 1.5 << endl;
}
else {
cout << "请输入0-6的数字";
continue;
}
}
return ;
}
#include <iostream>
using namespace std;
int main() {
int n;
while(cin >> n) {
int sum = ;
if(n > ) {
for(int i = n; i <= * n; i++) {
sum += i;
}
}
else {
for(int i = -n; i <= * (-n); i++) {
sum -= i;
}
}
cout << sum << endl;
}
return ;
}
#include <iostream>
using namespace std; int main() {
int n, m;
for(int i = ; i < ; i++) {
for(int j = ; j < ; j++) {
for(int k = ; k < ; k++) {
for(int l = ; l < ; l++) {
n = i * + j * + k * + l;
m = l * + k * + j * + i;
if(n * == m && m > ) cout << n << endl; //无限制m>0,会多输出0
}
}
}
}
return ;
}
#include <iostream>
using namespace std; struct Node
{
int data;
Node* next;
}; int main() {
int m;
cin >> m;
while (m--) {
int n;
cin >> n;
Node *head = new Node;
Node *p = new Node;
head = p;
p -> next = NULL;
p -> data = ;
for(int i = ; i <= n; i++) {
Node *q = new Node;
q -> data = i;
q -> next = NULL;
p -> next = q;
p = q;
}
p -> next = head;
int cnt = ;
while(head -> next != head) {
Node *t = new Node;
t = head -> next;
cnt++;
if(cnt % == ) {
cout << head -> next -> data << " ";
head -> next = t -> next;
}
else head = head -> next;
}
cout << head -> data << endl;
}
return ;
}
北京理工大学复试上机--2001A的更多相关文章
- 北京理工大学复试上机--2001B
1.请输入高度 h,输入一个高为 h,上底边长为 h的等腰梯形(例如 h=4,图形如下). **** ****** ******** ********** #include <ios ...
- Twin Prime Conjecture(浙大计算机研究生保研复试上机考试-2011年)
Twin Prime Conjecture Time Limit: 2000/1000 MS (Java/Othe ...
- HDU 1234 (浙大计算机研究生复试上机考试-2005年) 开门人和关门人 (水)
开门人和关门人 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Su ...
- ZOJ问题(2010浙江大学研究生复试上机题目[找规律] hdoj 3788)
ZOJ问题 pid=3788">点击打开链接 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ...
- 关键路径 p3 清华复试上机题
关键路径 p3 清华复试上机题 题目描述 小H为了完成一篇论文,一共要完成n个实验.其中第i个实验需要a[i]的时问去完成.小H可以同时进行若干实验,但存在一些实验,只有当它的若干前置实验完成时,才能 ...
- 九度OJ1486 /POJ 1029/2012北京大学研究生复试上机
wa到死!wa到死!这是一个看着简单,坑及其多的题! 坑一:POJ上是单组输入,九度上是多组输入,妈蛋要是研究生复试遇到这种大坑肯定死掉啊!而且对于codeforces比较习惯的 同学肯定会觉得巨坑无 ...
- Python数据分析与展示第3周学习笔记(北京理工大学 嵩天等)
入门学习马上结束辽. 1.Pandas库 import pandas as pd 两个数据类型:Series,DataFrame Series类型:数据+索引 自定义索引 b = pd.Series( ...
- python语言程序设计-北京理工大学-嵩天等课件代码整理
#TempConvert.py TempStr = input("请输入带有符号的温度值: ") if TempStr[-1] in ['F', 'f']: C = (eval(T ...
- 【4】【MOOC】Python游戏开发入门-北京理工大学【第三部分-游戏开发之机制(色彩与绘图)】
学习地址链接:http://www.icourse163.org/course/0809BIT021E-1001873001?utm_campaign=share&utm_medium=and ...
随机推荐
- nginx代理vue项目
很多项目的前端都使用vue编写的,在项目上线部署的时候,有些项目要求把前端页面和后台服务部署在不同的服务器,这就要求使用nginx代理,本文就来讲讲vue项目怎么使用nginx代理. 项目github ...
- STM32CubeMX 多通道 ADC DMA 配置 测试小程序
要点: 1.STM32F103C8T6单片机 2.ADC+DMA 多通道 重点是ADC+DMA配置,ADC+DMA配置如下 其他配置略略略略. 然后各位自行直看.ioc文件,生成代码后在while之前 ...
- Coursera课程笔记----计算导论与C语言基础----Week 1
计算机的基本原理(Week 1) 第一次数学危机 公元前500年,毕达哥拉斯学派,他们相信数是万物的本源:一切数均可表示成整数或者整数之比 然而毕达哥拉斯证明了勾股定理,某些直角三角形的三边比不能用整 ...
- C# 判断文件格式的一些总结
前提概述: 项目中 经常会有上传图片的地方 有的时候需要对图片类型做一些要求 这个时候就需要一些判断 虽然前段上传的时候可以去做类型的限制 或者后台接受的时候从file的type 中获取图 ...
- input唤起键盘影响移动端底部fixed定位
主要代码如下: public docmHeight = document.documentElement.clientHeight || document.body.clientHeight; // ...
- Ubuntu 18.04 新系统 允许root远程登录
1. 查看ssh服务器是否安装并启动 #sudo ps -e | grep ssh 1. 安装ssh服务器 #sudo apt-get install openssh-server 2. 配置sshd ...
- Git上传文件、文件夹到github
上传一个文件: $ git add test.txt 上传多个文件: $ git add test.txt demo.txt 同理: 上传一个文件夹: $ git add learngit 上传多个文 ...
- jquery-----ajax的几种方法
$.get(url,function(data,status){ if(status == 'success'){ layer.msg(data,{shift:1,time:2000},functio ...
- mybatis 新增返回id
第一种方式: 在实体类的映射文件 "*Mapper.xml" 这样写: <insert id="insertAndGetId" useGeneratedK ...
- spark aggregate函数
aggregate函数将每个分区里面的元素进行聚合,然后用combine函数将每个分区的结果和初始值(zeroValue)进行combine操作.这个函数最终返回的类型不需要和RDD中元素类型一致. ...