CodeForces 157B - Trace

手把手教你用二茂铁催化剂搞定醇的动力学拆分(保姆级实验避坑指南) 本文详细介绍了使用平面手性二茂铁催化剂进行醇的动力学拆分的全流程,包括催化剂选择与制备、反应体系搭建与条件优化、实时监测与反应淬灭、产物分离与纯化等关键步骤。通过实战案例和避坑指南,帮助实验人员实现>98% ee的拆分效果,特别适合需要高光学纯度二级芳基醇或烯丙醇的研究者。 阅读详情

B. Trace
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides, any two neighboring parts were painted different colors, that is, the red and the blue color were alternating, i. e. followed one after the other. The outer area of the wall (the area that lied outside all circles) was painted blue. Help Sherlock Holmes determine the total area of red parts of the wall.

Let us remind you that two circles are called concentric if their centers coincide. Several circles are called concentric if any two of them are concentric.

Input

The first line contains the single integer n (1 ≤ n ≤ 100). The second line contains n space-separated integers ri (1 ≤ ri ≤ 1000) — the circles' radii. It is guaranteed that all circles are different.

Output

Print the single real number — total area of the part of the wall that is painted red. The answer is accepted if absolute or relative error doesn't exceed 10 - 4.

Sample test(s)
input
1
1
output
3.1415926536
input
3
1 4 2
output
40.8407044967
Note

In the first sample the picture is just one circle of radius 1. Inner part of the circle is painted red. The area of the red part equals π × 12 = π.

In the second sample there are three circles of radii 1, 4 and 2. Outside part of the second circle is painted blue. Part between the second and the third circles is painted red. Part between the first and the third is painted blue. And, finally, the inner part of the first circle is painted red. Overall there are two red parts: the ring between the second and the third circles and the inner part of the first circle. Total area of the red parts is equal (π × 42 - π × 22) + π × 12 = π × 12 + π = 13π



================================


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

bool cmp(int a,int b)
{
    return a>b;
}

int main()
{
    int n,a[111];
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a,a+n,cmp);
    int flag=1,sum=0;
    for(int i=0;i<n;i++)
    {
        if(flag)
        {
            sum+=a[i]*a[i];
            flag=!flag;
        }
        else
        {
            sum-=a[i]*a[i];
            flag=!flag;
        }
    }
    double ans=sum*3.141592653589793;
    printf("%lf\n",ans);
    return 0;
}


基于YOLOv8的城市违建识别系统:从数据集构建到UI界面实现 YOLOv8是Ultralytics公司于2023年推出的最新一代YOLO(You Only Look Once)系列目标检测算法。更高效的骨干网络设计改进的锚框机制更精确的损失函数支持分类、检测、分割等多任务YOLOv8特别适合像违建识别这样的实时检测任务,能够在保持高精度的同时实现快速推理。 阅读详情

相关推荐

DC-DC电源芯片SY8303电路设计

SY8303高效率同步降压DC-DC转换器。这款芯片特别适用于需要较大负载电流(高达3A)的应用。SY8303在较宽的输入电压范围(4.5V至40V)内工作,能够将输入电能高效地转换为输出电能。此外,为使运行更为稳定,SY8303集成了主要的开关和同步开关,其导通电阻(RDS(ON))非常低,可以最大限度地减少导通损耗。一些特性,如短路保护、热关断以及自动恢复等,也有助于增强其可靠性和耐用性。

LuDvei的博客 9675

别再混淆了!一文搞懂ISO7816中PPS协商的‘专用模式’与‘协商模式’到底怎么用

本文深入解析ISO7816协议中PPS协商的‘专用模式’与‘协商模式’的区别与应用场景。通过外交礼仪类比和实战案例,详细阐述两种模式的技术实现、性能差异及优化策略,帮助开发者提升智能卡通信的稳定性和效率。

weixin_30838873的博客 249

西电2023秋季机器学习复习提纲

西电2023秋季机器学习复习提纲,希望对学弟学妹有帮助

weixin_62083045的博客 5656

ebpf之bcc程序入门

了解内核态**如何向用户态传递数据**(BPF_ARRAY,BPF_HASH等和相应增删改查函数,用户态中如何读取数据b[""].items()等函数),了解在挂载函数时**如何选择相应的探针**(kprobes、kretprobes、uprobes、uretprobes),了解如何**从挂载的函数中获取数据**(PT_REGS_PARM*、PT_REGS_RC、以及bpf中定义的有关函数,如bpf_get_current_pid_tgid()),就可以尝试自己编写bcc程序了。

qq_44927248的博客 2991

TC3xx芯片中断配置避坑指南:从AUTOSAR Davinci配置到SRN地址计算的完整流程

本文详细解析了英飞凌TC3xx芯片的中断配置流程,从AUTOSAR Davinci工具链到硬件调试的全链路指南。重点介绍了中断路由(IR)模块、服务请求节点(SRN)和中断控制单元(ICU)的配置技巧,帮助开发者避开常见陷阱,优化中断性能。

weixin_30628801的博客 413

推荐系统:NDCG评价指标及其Python实现方法

除了推荐任务,在二分类任务中,也可以计算该指标,代码如下: # ndcg def get_dcg(y_pred, y_true, k): #注意y_pred与y_true必须是一一对应的,并且y_pred越大越接近label=1(用相关性的说法就是,与label=1越相关) df = pd.DataFrame({"y_pred":y_pred, "y_true":y_true}) ...

lanyuelvyun的博客 8242

Codeforces Round #110 (Div. 2)——B

B. Trace time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output One day, as Sherlock Holmes was tracking down one

Learn as if you were to live forever 509

Windows11 - Ubuntu 双系统及 ROS、ROS2 安装

在本教程中,我们将使用 Ubuntu 20.04 版本,该版本使用了新的 Ubuntu 桌面安装程序,该程序将包含在今后发布的所有 Ubuntu 版本中。如果你选择了这个选项,你会看到一个简单的界面,允许你选择要安装Ubuntu的硬盘,并通过滑块来决定你希望Ubuntu使用的磁盘空间大小。如果你的电脑有多个硬盘驱动器,那么只要它们各自有自己的驱动器,这个选项就能让你在安装 Ubuntu 的同时安装现有的操作系统。在此屏幕上,系统会提示您输入您的姓名和您的计算机名称,以显示在网络上。

机器人控制与仿真应用 4509

codeforces 157B Trace

codeforces 157B Trace 题目链接:157B Trace One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as

codedz的博客 553

模型实战(32)之 yolo26 实现对全身关键点数据集 的训练与关键点检测

模型实战(32)之 yolo26 实现对全身关键点数据集 的训练与关键点检测

yohnyang的博客 90

【CloudCompare】Windows源码编译CloudCompare

本文详细介绍了在Windows环境下编译安装CloudCompare V2.12.0的过程。首先配置了PCL 1.14.1、CMake 3.30.6和QT 5.14.2开发环境,使用Visual Studio 2022工具集。然后下载源码并通过CMake进行配置,特别注意勾选PLUGIN_STANDARD_QPCL以支持PCD文件加载。最后在VS2022中编译安装,并指出Debug模式下可能遇到的VTK库后缀问题,需添加CMAKE_DEBUG_POSTFIX变量解决。整个流程涵盖了从环境搭建到最终编译成功的

yijiujiusan的博客 486

CF——Trace

Description   One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had severa

空白页 808

YOLO26改进策略【卷积层】| 引入注意力卷积模块RFAConv,关注感受野空间特征 助力YOLO26精度提升

RFAConv:创新空间注意力和标准卷积运算感受野空间特征是针对卷积核设计的,根据卷积核大小动态生成。以3×3卷积核为例,它由非重叠滑动窗口组成,每个窗口代表一个感受野滑块。

Limiiiing的博客 194

CodeForces 157B Trace

CodeForces 157B Trace

Dacc123的博客 1734

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

Trace CodeForces - 157B

asdf 给出N个同心圆 最外面的环形为红色。然后每个环形蓝红相间。求红色部分的面积. #include #include #include #include using namespace std; int cmp(int a,int b){ return a>b;} int main(void) { int a[105],i; int n; double square=0; ci

qq_35003691的博客 389

深度学习工具包 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")

codeforce_157B_水

B. TraceOne day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concent

NITjianbagengmu的博客 360

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

A. Omkar and Password

A. Omkar and Password time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Lord Omkar has permitted you to enter the Holy Church of Omkar! To test your worthiness, Omkar gives you a password which yo

满天星的博客 796

Analysis is very important! Twitter Portlet

Recently, I was doing twitter portlet. The task seems not hard. I have a list of twitter account, I just need to fetch them and display in my portlet. Last week, I got the task and don't know what twi

smile_juan 681

Codeforces Global Round 10 C. Omkar and Waterslide

Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible. Omkar currently has ???? supports arranged in a line, the ????-th of which has height ????????. Omkar wants to build his watersli

tomjobs的博客 562

Codeforces Round #110 (Div. 1)

codeforces一个不错的比赛,虽然我现在还不能参加div1的比赛,但是我还是好好的看了看昨天的那套题。不错!! A:Message 这个题栽在了读题上,Insert one letter to any end of the string.  就是这句话,我怎么也没想到,其中的end是端点的意思,也就是在任意一个端点插入字母。好吧,我承认我英语不咋地,其他的倒是还好想,s的第i个字符和u的第

水帘洞天 2329

mysql eBPF bcc_eBPF监控工具bcc系列九bcc Python

eBPF监控工具bcc系列九bcc Python接下来看下python方面的知识。1. 初始化1.1 BPF语法:BPF({text=BPF_program | src_file=filename} [, usdt_contexts=[USDT_object, ...]])创建一个BPF对象,能通过交互来产生输出。1.2 USDT语法:USDT({pid=pid | path=path})创建对象...

weixin_35941667的博客 583

NOIP 2012 提高组 复赛 day1 drive 开车旅行

NOIP 2012 提高组 复赛 day1 drive 开车旅行 1.首先扫了下样例,看了看数据范围,明白了,若是排序,冒泡是不可能了,需快速排序。 2.收收心,开始阅读题目。当务之急,根据题意,弄明白样例。 3.样例1读懂了,递归很明显,因有明显结束条件,dfs+回溯。 4.样例2读懂了,一开始以为X0是多余的,后再读题目,才发现X0与Xi可以不等,X0管输出的第一个数据,Xi管接

mrcrack的博客 393

codeforces A. Omkar and Password

题目 题意: 给你一个序列,现在这个序列中可以将相邻的不同的元素相加,可以重复若干次,问最后的会剩下几个元素。 思路: 除非全部相等的话,答案是nnn,否则都是111,因为只要有两个元素是不同的,肯定可以全部消除,比如A=B+CA=B+CA=B+C,那么我们就可以将A+BA+BA+B,这样ans=1ans=1ans=1。 #include <iostream> #include <cstring> #include <cstdio> #include <algor.

忘梦心的博客 684

CodeForces 165C - Another Problem on Strings

C. Another Problem on Strings time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A string is binary, if it con

coco430的专栏 1270

CodeForces 149B - Martian Clock

B. Martian Clock time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Having stayed home alone, Petya decided to

coco430的专栏 1077

CodeForces 165B - Burning Midnight Oil(二分)

B. Burning Midnight Oil time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output One day a highly important task was

coco430的专栏 1074
上一篇: CodeForces 151B - Phone Numbers
下一篇: CodeForces 155B - Combination(贪心)
coco430
博客等级 码龄14年 9粉丝 107原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值