C. Table Decorations

根据给定的红、绿、蓝三种颜色气球的数量,你需要找出能以三种不同颜色装饰的最大桌子数量。每张桌子不能使用同色气球。输入包含三整数r、g、b,分别代表红、绿、蓝气球数。输出最大可装饰的桌子数t。

链接:https://codeforces.com/problemset/problem/478/C

You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What maximum number t of tables can be decorated if we know number of balloons of each color?

Your task is to write a program that for given values rg and b will find the maximum number t of tables, that can be decorated in the required manner.

Input

The single line contains three integers rg and b (0 ≤ r, g, b ≤ 2·109) — the number of red, green and blue baloons respectively. The numbers are separated by exactly one space.

Output

Print a single integer t — the maximum number of tables that can be decorated in the required manner.

Examples

input

Copy

5 4 3

output

Copy

4

input

Copy

1 1 1

output

Copy

1

input

Copy

2 3 3

output

Copy

2

Note

In the first sample you can decorate the tables with the following balloon sets: "rgg", "gbb", "brr", "rrg", where "r", "g" and "b" represent the red, green and blue balls, respectively.

代码:

#include<bits/stdc++.h>
using namespace std;
long long n,s,t,b,k,c,l,r,d,ans,min1=0,mod=1e9+7;
long long a[10];
int main()
{
    cin>>a[1]>>a[2]>>a[3];
    sort(a+1,a+4);
    k=a[1]+a[2];
    if((a[1]+a[2]+a[3])/3<=k)
    cout<<(a[1]+a[2]+a[3])/3;
    else
    cout<<k;
}

 

eclipse.buildId=Version 1.19.0 java.version=21.0.3 java.vendor=Eclipse Adoptium BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=zh_CN Command-line arguments: -os win32 -ws win32 -arch x86_64 This is a continuation of log file C:\Users\WBF\STM32CubeIDE\workspace_1.19.0\.metadata\.bak_0.log Created Time: 2025-11-15 04:54:56.996 org.eclipse.ui 错误 Sat Nov 15 04:55:01 CST 2025 Conflicting handlers for org.eclipse.ui.file.close: {org.eclipse.ui.internal.CloseEditorHandler@6a906078} vs {org.eclipse.ui.internal.CloseEditorHandler} in: org.eclipse.ui.contexts.dialog java.lang.IllegalStateException: Conflicting handlers: {[org.eclipse.ui.internal.CloseEditorHandler@6a906078, for 'org.eclipse.ui.file.close', in WorkbenchContext, active=true, sourcePriority=0, participating=true]} vs {[org.eclipse.ui.internal.CloseEditorHandler, for 'org.eclipse.ui.file.close', in WorkbenchContext, active=true, sourcePriority=0, participating=true]} in: org.eclipse.ui.contexts.dialog at org.eclipse.ui.internal.handlers.LegacyHandlerService$HandlerSelectionFunction.compute(LegacyHandlerService.java:143) at org.eclipse.e4.core.internal.contexts.ValueComputation.get(ValueComputation.java:70) at org.eclipse.e4.core.internal.contexts.EclipseContext.internalGet(EclipseContext.java:265) at org.eclipse.e4.core.internal.contexts.EclipseContext.internalGet(EclipseContext.java:276) at org.eclipse.e4.core.internal.contexts.EclipseContext.get(EclipseContext.java:230) at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.lookUpHandler(HandlerServiceImpl.java:99) at org.eclipse.ui.internal.handlers.E4HandlerProxy.handlerChanged(E4HandlerProxy.java:115) at org.eclipse.core.commands.AbstractHandler.fireHandlerChanged(AbstractHandler.java:77) at org.eclipse.ui.internal.handlers.HandlerProxy.lambda$1(HandlerProxy.java:371) at org.eclipse.core.commands.AbstractHandler.fireHandlerChanged(AbstractHandler.java:77) at org.eclipse.ui.internal.AbstractEnabledHandler.setEnabled(AbstractEnabledHandler.java:43) at org.eclipse.ui.internal.AbstractEvaluationHandler.lambda$0(AbstractEvaluationHandler.java:55) at org.eclipse.ui.internal.services.EvaluationReference.evaluate(EvaluationReference.java:116) at org.eclipse.ui.internal.services.EvaluationReference.changed(EvaluationReference.java:100) at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:105) at org.eclipse.e4.core.internal.contexts.EclipseContext.processScheduled(EclipseContext.java:358) at org.eclipse.e4.core.internal.contexts.EclipseContext.set(EclipseContext.java:374) at org.eclipse.ui.internal.services.EvaluationService$1.changed(EvaluationService.java:78) at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:105) at org.eclipse.e4.core.internal.contexts.EclipseContext.processScheduled(EclipseContext.java:358) at org.eclipse.e4.core.internal.contexts.EclipseContext.set(EclipseContext.java:374) at org.eclipse.e4.core.internal.contexts.EclipseContext.activate(EclipseContext.java:661) at org.eclipse.e4.ui.internal.workbench.swt.ShellActivationListener$2.run(ShellActivationListener.java:137) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47) at org.eclipse.e4.ui.internal.workbench.swt.ShellActivationListener.activate(ShellActivationListener.java:133) at org.eclipse.e4.ui.internal.workbench.swt.ShellActivationListener.handleEvent(ShellActivationListener.java:76) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1319) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1173) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1198) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1183) at org.eclipse.swt.widgets.Decorations.WM_ACTIVATE(Decorations.java:1523) at org.eclipse.swt.widgets.Shell.WM_ACTIVATE(Shell.java:2338) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4724) at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:342) at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1482) at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2311) at org.eclipse.swt.widgets.Display.windowProc(Display.java:5091) at org.eclipse.swt.internal.win32.OS.BringWindowToTop(Native Method) at org.eclipse.swt.widgets.Decorations.bringToTop(Decorations.java:215) at org.eclipse.swt.widgets.Shell.open(Shell.java:1292) at org.eclipse.jface.window.Window.open(Window.java:795) at org.eclipse.ui.internal.statushandlers.InternalDialog.open(InternalDialog.java:297) at org.eclipse.ui.internal.statushandlers.WorkbenchStatusDialogManagerImpl.doAddStatusAdapter(WorkbenchStatusDialogManagerImpl.java:255) at org.eclipse.ui.internal.statushandlers.WorkbenchStatusDialogManagerImpl.addStatusAdapter(WorkbenchStatusDialogManagerImpl.java:188) at org.eclipse.ui.statushandlers.WorkbenchStatusDialogManager.addStatusAdapter(WorkbenchStatusDialogManager.java:152) at org.eclipse.ui.statushandlers.WorkbenchErrorHandler.showStatusAdapter(WorkbenchErrorHandler.java:97) at org.eclipse.ui.statushandlers.WorkbenchErrorHandler.lambda$0(WorkbenchErrorHandler.java:61) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4099) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3715) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153) at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:639) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:546) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:143) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:109) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:439) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:271) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:668) at org.eclipse.equinox.launcher.Main.b
最新发布
11-16
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值