CodeFroces 817B. Makes And The Product(构造)
来源:互联网 发布:淘宝客服物流用语 编辑:程序博客网 时间:2024/05/21 10:13
分类讨论下即可。
代码如下:
#include<iostream>#include<cstdio>#include<vector>#include<queue>#include<utility>#include<stack>#include<algorithm>#include<cstring>#include<string>#include<cmath>#include<set>#include<map>using namespace std;const int maxn = 1e5 + 5;int n, a[maxn];int main() {#ifndef ONLINE_JUDGE//freopen("in.txt", "r", stdin);// freopen("out.txt", "w", stdout);#endifscanf("%d", &n);for(int i = 0; i < n; i++)scanf("%d", &a[i]);sort(a, a + n);if(a[0] == a[2]) {long long c = 3, j = 3;while(a[j] == a[2]) {j++, c++;}printf("%I64d\n", c * (c - 1) * (c - 2) / 6);} else if(a[0] == a[1]) {long long c = 1, j = 3;while(a[j] == a[2]) {j++, c++;}printf("%I64d\n", c);} else if(a[1] == a[2]) {long long c = 2, j = 3;while(a[j] == a[2]) {j++, c++;}printf("%I64d\n", c * (c - 1) / 2);} else {long long c = 1, j = 3;while(a[j] == a[2]) {j++, c++;}printf("%I64d\n", c);}return 0;}
阅读全文
0 0
- CodeFroces 817B. Makes And The Product(构造)
- Codeforces 817B Makes And The Product
- 【Codeforces 817B. Makes And The Product】
- CodeForces-817B Makes And The Product 解题报告
- Educational Codeforces Round 23 B. Makes And The Product
- Educational Codeforces Round 23#B. Makes And The Product
- codeforces817b Makes And The Product
- codeforce817B Makes And The Product (排序)
- CodeFroces 823B. Petya and Exam(构造题)
- CodeFroces 831B. Keyboard Layouts(构造题)
- CodeFroces 827B. High Load(构造法)
- Codefroces 280 div2 B. Vanya and Lanterns
- CodeFroces 766B Mahmoud and a Triangle
- Codefroces 410 B.Mike and strings
- codefroces 2B The least round way
- codefroces 716B.Complete the Word
- CodeFroces 834B. The Festive Evening(暴力)
- CodeFroces 175B. Plane of Tanks: Pro (构造)
- ubuntu python2.7安装MySQLdb
- 用aardio给python写个图形界面
- JavaScript 调试
- java正则表达式匹配空格 tab空格 制表符
- JavaScript的引用类型1(Object Array)
- CodeFroces 817B. Makes And The Product(构造)
- CUDA nvcc编译步骤简单讲解
- (Windows)在phpstorm 配置php interpreter,搭建php debug环境
- C++ STL priority_queue
- linux配置java环境变量(详细)
- 在一个int数组里查找出所有这样的数,它大于等于左侧所有数,小于等于右侧所有数。
- android fragment 刷新功能
- 在MvvmLight下使用{x:Bind}
- 关于http在servlet以及jsp中的一些理解