网页学习体会

  • 首页
  • 个人博客
您的位置: 首页  >  IT文章  >  Codeforces Mafia

Codeforces Mafia

分类: IT文章 • 2024-09-18 13:45:13

题目链接:http://codeforces.com/problemset/problem/348/A

代码:

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

int main()
{
    //freopen("E:\acm\input.txt","r",stdin);
    int n;
    scanf("%d",&n);

    long long L,R;
    L = R = 0;
    for(int i=1; i<=n; i++)
    {
        long long a;
        scanf("%I64d",&a);
        R += a;
        L = max(L,a);
    }
    long long sum = R;
    while(L < R)
    {
        long long mid = (L + R)/2;
        if( mid*(n-1) < sum)  L = mid + 1;
        else                 R = mid;
    }
    printf("%I64d
",L);
}
View Code

相关推荐

  • Codeforces —— Check Transcription(1056E) 题意: 思路 代码
  • Codeforces —— Let's Play the Words?(1277D) 题意 思路 代码
  • Codeforces —— New Year and Conference(1284D) 题意 思路 代码
  • Codeforces —— Felicity is Coming!(757C) 题意 思路 代码
  • Codeforces —— Complete Tripartite(1228D) 题意 思路 代码
  • Codeforces —— String(128B) 题意 思路 代码
  • CodeForces
  • codeforces round 746 div2 C-E
  • codeforces 1097b(dfs)
  • Codeforces Round #599 D Yet Another Monster Killing Problem
  • Nginx的平滑升级记录---适用于编译安装的Nginx
  • 基于FCM的消息推送功能 需求背景 文档分析 项目运用 使用总结 参考资料
    网站免责声明 网站地图 最新文章 用户隐私 版权申明
本站所有数据收集于网络,如果侵犯到您的权益,请联系网站进行下架处理。   

Copyright © 2018-2021   Powered By 网页学习体会    备案号:   粤ICP备20002247号