博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Gym-101502K Malek and Summer Semester
阅读量:4157 次
发布时间:2019-05-26

本文共 1371 字,大约阅读时间需要 4 分钟。

Gym-101502K Malek and Summer Semester


题意:M这学期修了n门课,给出这些课的分数,判断这学期M是否通过。M要通过这学期,必须至少通过ceil(n*m)门课。m输入会给出,一门课的成绩>=50才算做通过。ceil(x)是大于或等于x的最小的整数,例如:ceil(0.95)=1, ceil(4)=4, ceil(7.001)=8。做法:(1)直接使用c的库函数ceil()。ceil()返回不小于其参数的最小整数值。这个值以double的形式返回。与之相关的floor()返回不大于其参数的最大整数值。(2)自己动手写一个简单的my_ceil(),见代码。

(1)

#include 
#include
intmain() { int t, n, i, score, sum, o; double m; scanf("%d", &t); while( t-- ) { scanf("%d %lf", &n, &m); i = n; sum = 0; while( i-- ) { scanf("%d", &score); if( score >= 50 ) { sum++; } } o = ceil(n * m); if( sum >= o ) { printf("YES\n"); } else { printf("NO\n"); } } return 0;}

(2)

#include 
intmy_ceil(double x) { int ans; ans = x; if( ans == x ) { return ans; } else { return ans + 1; }}intmain() { int t, n, i, score, sum, o; double m; scanf("%d", &t); while( t-- ) { scanf("%d %lf", &n, &m); i = n; sum = 0; while( i-- ) { scanf("%d", &score); if( score >= 50 ) { sum++; } } o = my_ceil(n * m); if( sum >= o ) { printf("YES\n"); } else { printf("NO\n"); } } return 0;}

转载地址:http://yvkxi.baihongyu.com/

你可能感兴趣的文章
Online Multi-Object Tracking via Structural Constraint Event Aggregation
查看>>
The Solution Path Algotithm for Identity-Aware Multi-Object Tracking
查看>>
Groupwise Tracking of Crowded Similar-Appearance Targets from Low-Continuity Image Sequences
查看>>
CDTS: Collaborative Detection, Tracking, and Segmentation for Online Multiple Object Segmentation
查看>>
Deep Network Flow for Multi-Object Tracking
查看>>
Multiple People Tracking by Lifted Multicut and Person Re-identification
查看>>
Multi-Object Tracking with Quadruplet Convolutional Neural Networks
查看>>
关于多目标跟踪的一点理解
查看>>
Learning by tracking:Siamese CNN for robust target association
查看>>
MUSTer:Multi-Store Tracker:A Cognitive Psychology Inspired Approach to Object Tracking
查看>>
Understanding and Diagnosing Visual Tracking Systems
查看>>
Multiple People Tracking by Lifted Multicut and Person Re-identification
查看>>
Visual Tracking Using Attention-Modulated Disintegration and Integration
查看>>
Action-Decision Networks for Visual Tracking with Deep Reinforcement Learning
查看>>
Multiple Object Tracking with High Performance Detection and Appearance Feature
查看>>
深度学习入门(上)-第一章 必备基础知识点
查看>>
ubuntu unzip解压时提示错误 解决方法
查看>>
sprintf函数的说明
查看>>
BOOST_TYPEOF和BOOST_AUTO 作用
查看>>
随机森林概述
查看>>