杭电oj 2004-2005-2006 C++

【ACM】【杭电】用C语言实现2004 实现代码 题目很简单,应该没什么好说的了吧 #include<stdio.h> int main() { int grade; while(scanf("%d",&grade)!=EOF) { if(90<=grade&&grade<=100) printf("%c\n",'A'); else if(80<=grade&&grade<=89) .. 阅读详情

2004 成绩转换,把百分制转换成等级
在这里插入图片描述

#include <iostream>
using namespace std;
int main()
{
    int t;
    while(cin >> t)
    {
       if(t<0 || t>100)
          cout << "Score is error!" << endl;
       else if(t>=90 && t<=100) 
          cout << "A" << endl;
       else if(t>=80 && t<=89) 
          cout << "B" << endl;
       else if(t>=70 && t<=79) 
          cout << "C" << endl;
       else if(t>=60 && t<=69) 
          cout << "D" << endl;
       else 
          cout << "E" << endl;
    }
    return 0;
}

2005 第几天
在这里插入图片描述

#include <iostream>
using namespace std;
int main()
{
    int y,m,d;
    int m1[11] = {31,28,31,30,31,30,31,31,30,31,30};
    int m2[11] = {31,29,31,30,31,30,31,31,30,31,30};
    while(cin >> y)
    {
       int s=0;
       cin.ignore();//忽略斜杠
       cin >> m;
       cin.ignore();
       cin >> d;
       if((y%400==0) || (y%4==0)&&(y%100!=0))//闰年
           {
               for(int i=0;i<m-1;i++)
               {
                   s += m2[i];
               }
               s += d;
           }
        else
           {
               for(int i=0;i<m-1;i++)
               {
                   s += m1[i];
               }
               s += d;
           }
        cout << s << endl;
    }
    return 0;
}

注意s的定义位置,每一轮s都需要重新计算。

2006 求奇数的乘积
在这里插入图片描述

#include <iostream>
using namespace std;
int main()
{
    int n,a;
    int result = 1;
    while(cin >> n)
    {
       while(n--)
       {
          cin >> a;
          if(a%2==1) result *= a;
       }
       cout << result << endl;
       result = 1;
    }
    return 0;
}
杭电OJ100题——2006-2008(C++版) 求奇数的乘积 Problem Description 给你n个整数,求他们中所有奇数的乘积。  Input 输入数据包含多个测试实例,每个测试实例占一行,每行的第一个数为n,表示本组数据一共有n个,接着是n个整数,你可以假设每组数据必定至少存在一个奇数。  Output 输出每组数中的所有奇数的乘积,对于测试实例,输出一行。  Sample Input 3 1 2 3 4 2 ... 阅读详情

相关推荐

SDR实战(四)-AD9361使用手册(三)

本节定义了并行数据端口和串行外设接口(SPI),它们使得AD9361与基带处理器(BBP)之间能够传输数据和控制/状态信息。图63展示了这些接口,并提供了AD9361和BBP在宽带无线系统中使用方式的高级概述。数据接口以两种模式之一运行:兼容标准CMOS模式或兼容低压差分信号(LVDS)模式。每个接口都具有以下部分描述的独特特性。使用CMOS模式时:保持了单端-CMOS逻辑兼容性。可以使用一个或两个数据端口。使用两个端口可以提高数据吞吐量。

hutx0924的博客 6244

杭电oj —— 2004

/* 输入一个百分制的成绩t,将其转换成对应的等级,具体转换规则如下: 90~100为A; 80~89为B; 70~79为C; 60~69为D; 0~59为E; */ #include&lt;cstdio&gt; int main(){ float score; while(scanf("%f",&amp;score) != EOF){ if(score &gt;= 90 &amp;&a...

LiLi_code的博客 297

WRF-BEM相关参数说明

本参数适用于WRF-BEM模拟武汉市气候。

m0_60013472的博客 1896

杭电OJ_2004(C++版)

#include <iostream> using namespace std; int main(void){ int a; while(cin>>a) { if (a<0||a>100) cout<<"Score is error!"<<endl; else if(a>=90&&a<=10...

酱紫蛙的博客 474

GEO优化实战:用AnswerBit量化AI搜索可见度与品牌监控体系

生成式引擎优化(GEO)正取代传统SEO,成为品牌在AI搜索生态中获取可见度的关键。当用户习惯从“翻列表”转向“直接问AI”,品牌能否被生成式引擎识别、引用并正向推荐,直接决定了其在用户决策链条中的存在感。AI搜索可见度因此从模糊概念演变为可度量的运营指标,涵盖提及率、引文率、情感分与回源质量等维度。腾讯AnswerBit作为答案侧分析工具,帮助运营者拆解AI回复中的品牌语境与引用来源,让优化动作有据可循。从内容结构化改造、品牌实体建设到第三方权威背书,GEO要求团队建立“度量-优化-再度量”的闭环。文章结

weixin_31100517的博客 150

若依前后端分离版实战:MQTT集成保姆级教程(含MQTTX测试工具使用)

本文详细介绍了在若依前后端分离架构中集成MQTT协议的完整流程,包括环境搭建、核心配置、安全实践及性能优化。通过MQTTX测试工具的使用和实战代码示例,帮助开发者快速实现物联网场景下的实时通信功能,提升系统稳定性和效率。

weixin_30664051的博客 456

杭电oj-2004

#include<iostream> #include<cmath> using namespace std; int main() { double a; while(cin>>a) { if(a>100 || a<0) { printf("Score is error!\n"); } else{ int t=(int)(a/10); switch (t) { case 10: printf("A\

weixin_43794332的博客 241

解决开着代理情况下pip或魔搭下载失败

最近由于经常配环境导致,老是要来回切clash关掉代理,非常的不方便如下面的,魔搭模型下载失败如下面的,pip换源后下载失败。

风吹落叶的博客 2950

杭电ACM2006C++

#include&lt;iostream&gt; using namespace std; int main() { int n,i,a; while(cin&gt;&gt;n) { int s=1;//s不能在while循环外定义,不然会导致s的数据无法更新 for(i=0;i&lt;n;i++) { cin&gt;...

xiaoxiaokeke_的博客 517

YOLOv8【第十一章:视频追踪与流处理篇·第6节】BoT-SORT 改进:结合相机运动补偿(CMC)提升追踪稳定性!

🏆 本文收录于 《YOLOv8实战:从入门到深度优化》 专栏。该专栏系统复现并梳理全网各类 YOLOv8 改进与实战案例(当前已覆盖分类 / 检测 / 分割 / 追踪 / 关键点 / OBB 检测等方向),坚持持续更新 + 深度解析,质量分长期稳定在 97 分以上,可视为当前市面上 覆盖较全、更新较快、实战导向极强 的 YOLO 改进系列内容之一。

**My Coding Family** 718

《深入掌握MongoDB数据库》 - 专栏介绍和目录

本专栏系统讲解MongoDB从基础到高级的全栈知识,涵盖安装配置、核心操作、性能优化、安全运维等核心内容。基础部分包括CRUD操作、数据类型、查询语法等入门知识;进阶部分深入索引优化、聚合查询、事务处理等高级特性;核心原理解析存储引擎与数据格式;安全运维则聚焦访问控制、认证机制、审计日志等企业级实践。通过实战案例与最佳实践,帮助开发者全面掌握MongoDB在不同场景下的应用,适合各层次技术人员系统学习。

数据知道的博客 2994

杭电oj刷题第一阶段答案

文章目录输入输出练习1000 A+B1089 A+B for Input-Output Practice (I)1090 A+B for Input-Output Practice (II)1091 A+B for Input-Output Practice (III)1092 A+B for Input-Output Practice (IV)1093 A+B for Input-Output ...

difend的博客 3万+

利用插件扩展 Qt 应用程序

不仅 Qt 本身可以通过插件进行扩展,而且 Qt 应用程序也可以通过插件来扩展,这需要应用程序使用 `QPluginLoader` 检测和加载插件。

青春不老,奋斗不止! 1万+

【杭电oj】练习自用

很搞笑,我居然这个代码还能写错,真的是太久没写了,手生的要死。 Problem 2001 Problem 2002 Problem 2004 好简单的题,大学读了四年还是在做这种题,好累呀,生活好可怕。 你好! 这是你第一次使用 Markdown编辑器 所展示的欢迎页。如果你想学习如何使用Markdown编辑器, 可以仔细阅读这篇文章,了解一下Markdown的基本语法知识。我们对Markdown编辑器进行了一些功能拓展与语法支持,除了标准的Markdown编辑器功能,我们增加了如下几点新功能,帮助

Youweretrouble的博客 1221

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

杭电OJ平台刷题全记录

#include int main() { printf("这是一篇文章,用于记录我在杭电OJ平台刷题时的题解与困惑,希望能够参加ACM。"); }

NeoA_的博客 1151

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

杭电oj部分题 · 2000~2011、2039

sort// 自定义结构体int age;// 自定义比较函数:按年龄降序排序// 用自定义规则排序// 输出:Charlie(25) → Alice(20) → Bob(18)return 0;是 C++ 算法库,封装了排序、查找、最值等通用算法,避免重复造轮子;核心函数:新手优先掌握sort()swap(),覆盖 80% 的基础场景;关键规则:算法的范围是 “左闭右开”,自定义排序需写比较函数;通用性:支持数组、vectorstring。

someoneZzyw的博客 712

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

杭电ACM 2000->2099 100道题 详细解题报告出炉

我去年暑假花了5天,把杭电ACM网站上2000到2099这100道题全AC了,又花了10来天精心写解题报告。里面包括题目、解题思路、编程技巧以及参考源码。所有代码都是使用C/C++写的。最近整理资料时无意间发现,打包成chm文件和大家分享。我已经上传到优快云上了。下载地址:http://download.youkuaiyun.com/source/492194也可到我的Google Sites上下载

子清行 3万+

杭电OJ 2000-2100题解

所以第n年的牛 = 第n - 3年的牛数量(这年的所有牛在第n年都会生一个孩子) + 去年的牛数量;2005题解:闰年的判断:四年一闰,百年不闰,四百年一闰;(闰年2月为29天)2019题解:上来直接排序复杂度高,已知有序找到相应位置插入即可;已知小母牛从第四年开始会生孩子。用递归找前面年份的牛数量即可;

qq_54369963的博客 2649

【HDU100】杭电入门一百道 C++ 全 题 解

1. 好像没有HDU2038 呜呜呜2. 主要是整合提供了AC的代码,思路不太详细qwq目录前言1. ASCII码排序(HDU2000)2. 计算两点间的距离(HDU2001)3. 计算球体积(HDU2002)4. 求绝对值(HDU2003)5. 成绩转换(HDU2004)6. 第几天?(HDU2005)7. 求奇数的乘积(HDU2006)8. 平方和与立方和(HDU2007)9. 数值统计(HDU2008)10. 求数列的和(HDU2009)11. 水仙花数(HDU2010)

Ctrl AC的博客 1万+

杭电oj2000到2011做题记录(水题)

2000ASCLL码排序 #include<iostream> using namespace std; int main(){ char a,b,c; char temp; while(cin>>a>>b>>c){ if(a>b){//a存a b最小的 temp=a; a=b; b=temp; } if(a>c){//a和c比...

weixin_45191675的博客 217

杭电OJ刷题Day2简单操作(2000-2011、2039)

第一阶段:入门(20211122)二、简单操作20002001200220032004200520062007200820092010201120392039 二、简单操作 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2039 2039

qq_42713936的博客 1473

算法竞赛、数据结构学习路线以及教程:为你的算法学习提供便利!

Algorithm All in ONE???? Let Everyone Study Algorithm Easier???? 仓库在这里 因为准备实习????,整理了一下算法的课件、书籍、论文、习题、OJ网站,总结了学习路线。 不管是准备面试,进BAT????; 还是自学算法竞赛????; 或者单纯的课外拓展????; 不管你算法能力如何,这个仓库里总有适合你的算法学习宝藏✈️! 对Coder????‍????而言,算法学习都是有必要的,只是不同领域可能要求深浅不同 所以,咱们开

1316

新手入坑杭电百题2000->2099

看着隔壁大佬在做百题,我也想冒死四四/坏笑。 题目在这里:这是入口 2090-2099 2080-2089 2070-2079 2060-2069 2050-2059 2040-2049 2030-2039:https://blog.youkuaiyun.com/qq_42756958/article/details/96894985 2020-2029:https://blog.csdn...

雷恩的博客 3139

万恶的oj笔记之【111030】

平常两个小时搞定的题目,整搞了2天 T.T 还是要总结 hdoj2002-- 没事做多用double,scanf时用%lf,除非有内存限制,但貌似现在还谈不上。 printf时%4.3f别写成%4,3f ---------------------------- #include #define PI 3.1415927 int main() { double ...

weixin_30487201的博客 147

数据结构与算法_算法、数据结构学习指南

Algorithm All in ONE?Let Everyone Study Algorithm Easier?因为准备实习?,整理了一下算法的课件、书籍、论文、习题、OJ网站,总结了学习路线。•不管是准备面试,进BAT?;•还是自学算法竞赛?;•或者单纯的课外拓展?;•不管你算法能力如何,这个仓库里总有适合你的算法学习宝藏✈️!对Coder?‍?而言,算法学习都是有必要的,只是不同领...

weixin_39569389的博客 2968

杭电OJ 2006(C++)

求奇数的乘积 #include<iostream> using namespace std; int main() { int i , sum = 1 , n; while(cin>>n) { int *a = new int[n]; for(i = 0 ; i < n ; i++ ) { cin>>a[i]; if(a[i] % 2 != 0) sum *= a[i]; } cout<< sum <

evernight_17的博客 154
上一篇: 杭电oj 2003 C++ 求绝对值
下一篇: 杭电oj 2007-2008-2009
cloudless_sky
博客等级 码龄8年 106粉丝 128原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值