package study01; import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); //正数的个数 int count1 = 0; //负数的个数 int count2 = 0; int input = sc.nextInt(); while (input != 0) { if (input > 0)…
题目链接:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1090 找到所有数的和,然后再原数组里二分找符合条件的第三个数. #include <bits/stdc++.h> using namespace std; ; const int maxm = maxn * maxn; typedef struct R { int x, y, z; R(){} R(int x, int y, int z) : x(x), y…
题目: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: Elements in a triplet (a,b,c) must be in non-descending order. (ie, a ≤ b ≤ c) The s…
没心情写数学题啦啊 好难啊 #include<bits/stdc++.h> using namespace std; set<int> s; set<int>::iterator it; int main () { s.clear(); ;i*i<=1e9;i++) s.insert(i*i); int n; scanf("%d",&n); ; ;i*i<=n/;i++) { int t = n-i*i; if(s.find(…