当前位置:网站首页>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!”
边栏推荐
- Large neural networks may be beginning to realize: the chief scientist of openai leads to controversy, and everyone quarrels
- 逆变器simulink模型——处理器在环测试(PIL)
- QT信号槽总结-connect函数错误用法
- 2837xd 代码生成——StateFlow(4)
- How does {} prevent SQL injection? What is its underlying principle?
- 职业规划和发展
- vs+qt 设置应用程序图标
- 2837xd代码生成模块学习(3)——IIC、eCAN、SCI、Watchdog、eCAP模块
- [Yu Yue education] University Physics (Electromagnetics) reference materials of Taizhou College of science and technology, Nanjing University of Technology
- 2837xd code generation - stateflow (4)
猜你喜欢
Share a blog (water blog)
阿里云ack介绍
阿里云SLS日志服务
Bugkuctf-web21 (detailed problem solving ideas and steps)
UE illusory engine programmed plant generator setup -- how to quickly generate large forests
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedd
2837xd code generation - Supplement (2)
Alibaba cloud ack introduction
This monitoring system makes workers tremble: turnover intention and fishing can be monitored. After the dispute, the product page has 404
三相并网逆变器PI控制——离网模式
随机推荐
三相并网逆变器PI控制——离网模式
Error reporting on the first day of work (incomplete awvs unloading)
Int to string, int to qstring
2837xd Code Generation - stateflow (4)
Bugkuctf-web16 (backup is a good habit)
int与string、int与QString互转
ICLR 2022: how does AI recognize "things I haven't seen"?
[unreal] animation notes of the scene
【UE5】AI随机漫游蓝图两种实现方法(角色蓝图、行为树)
Read Day6 30 minutes before going to bed every day_ Day6_ Date_ Calendar_ LocalDate_ TimeStamp_ LocalTime
XA Transaction SQL Statements
Typora installation package sharing
UE5——AI追逐(蓝图、行为树)
Project practice, redis cluster technology learning (6)
About the college entrance examination
Idempotent design of Internet API interface
2837xd代码生成模块学习(3)——IIC、eCAN、SCI、Watchdog、eCAP模块
UE4 night lighting notes
Project practice, redis cluster technology learning (IX)
Ckeditor 4.10.1 upload pictures to prompt "incorrect server response" problem solution