当前位置:网站首页>Translation d30 (with AC code POJ 28:sum number)
Translation d30 (with AC code POJ 28:sum number)
2022-07-02 10:06:00 【Ctrl AC】
“ Ctrl AC! Together AC!”
The original title is :Sum Number
My translation :
describe
Given a N Sequence of Numbers . How many numbers in the sequence are equal to the sum of two different numbers in the sequence .
Input
first line : A positive integer N(N<=100). The second line :N A positive integer (<=100000).
Output
An integer .
AC Code :
#include<bits/stdc++.h>
using namespace std;
int num[105];
int sum[5000];
int main(){
int n;cin>>n;
for(int i=0;i<n;i++){
cin>>num[i];
}
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
if(num[i]!=0&&num[j]!=0)
sum[num[i]+num[j]]++;
}
}
int ans=0;
for(int i=0;i<n;i++){
if(sum[num[i]]) ans++;
}
cout<<ans<<endl;
return 0;
}Thank you for reading !!!
“ Ctrl AC! Together AC!”
边栏推荐
- Project practice, redis cluster technology learning (VIII)
- Tee command usage example
- vs+qt 设置应用程序图标
- Introduction to go language
- C language programming problems
- Junit4 runs MVN test test suite upgrade scheme
- 2837xd code generation - stateflow (4)
- [ue5] blueprint making simple mine tutorial
- 2837xd code generation - stateflow (3)
- Skywalking理论与实践
猜你喜欢
随机推荐
[unreal] animation notes of the scene
Navicat remote connection MySQL reports an error 1045 - access denied for user 'root' @ '222.173.220.236' (using password: yes)
MySQL default transaction isolation level and row lock
Tools used for Yolo object recognition and data generation
Ue5 - ai Pursuit (Blueprint, Behavior tree)
The road is blocked and long, and the line is coming
UE5——AI追逐(藍圖、行為樹)
[ue5] animation redirection: how to import magic tower characters into the game
How much is it to develop a system software in Beijing, and what funds are needed to develop the software
Image recognition - Data Acquisition
Blender multi lens (multi stand) switching
Bugkuctf-web21 (detailed problem solving ideas and steps)
Database -- acid of transaction -- introduction / explanation
Matlab生成dsp程序——官方例程学习(6)
Configuration programmée du générateur de plantes du moteur illusoire UE - - Comment générer rapidement une grande forêt
cmake的命令-官方文档
2837xd code generation module learning (1) -- GPIO module
并网逆变器PI控制(并网模式)
ESLint 报错
Blender多镜头(多机位)切换








