العربية
فتح في Telegram

منشورimport java.util.*;

19 أبريل 2025
D
Deloitte | COGNIZANT | IBM | CAPGEMINI
import java.util.*; public class Main { public static long solve(int n, int[] wealth) { int maxWealth = 0; for (int val : wealth) { maxWealth = Math.max(maxWealth, val); } int maxPossibleSum = 2 * maxWealth; Set<Long> uniquePowers= new HashSet<>(); long p = 1; while (p <= maxPossibleSum) { uniquePowers.add(p); p *= 3; } Map<Integer, Integer> freq = new HashMap<>(); for (int w : wealth) { freq.put(w, freq.getOrDefault(w, 0) + 1); } long count = 0; for (int a : freq.keySet()) { for (long x : uniquePowers) { long b = x - a; if (b < 0 || b > Integer.MAX_VALUE) continue; if (freq.containsKey((int)b)) { if (a < b) { count += (long) freq.get(a) * freq.get((int)b); } else if (a == b) { count += (long) freq.get(a) * (freq.get(a) - 1) / 2; } } } } return count; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] wealth = new int[n]; for (int i = 0; i < n; i++) { wealth[i] = sc.nextInt(); } System.out.println(solve(n, wealth)); } } valid pairs✅✅ #zl_technologies
1K ·

بجوارها في الخلاصة

DDeloitte | COGNIZANT | IBM | CAPGEMINICTS COMMUNICATION✅✅ contact : @MLCODER2DDeloitte | COGNIZANT | IBM | CAPGEMINIGot selected for IBM 🥳🥳✅✅✅ 100% results for any interview and exam ✅ IBM offline coding help👇 https://t.me/python_java_Coding/8426 Contact: @MLCODER2
هذه الرسالة
DDeloitte | COGNIZANT | IBM | CAPGEMINISELECT product_name FROM products WHERE price <= 5 ORDER BY price DESC, product_name ASC; SQL✅ #zl_technologiesDDeloitte | COGNIZANT | IBM | CAPGEMINICTS 9AM Aptitude ✅✅✅ Contact : @MLCODER2
DDeloitte | COGNIZANT | IBM | CAPGEMINIDeloitte | COGNIZANT | IBM | CAPGEMINI@python_java_Coding · قناة · التقنية
7 178مشتركون406متوسط وصول المنشور
خلاصة المجتمع فتح في Telegram

خلاصة عامة مفتوحة من فهرس البحث ChatCrawler — «Google لـ Telegram العام»؛ تُحدَّث كلما زحفنا إلى المجتمع. الأوقات بتوقيت UTC.

محتوى عام فقط، وAPI Telegram الرسمي. عن المشروع · الأسئلة الشائعة · حدود الفهرس · إزالة صفحة · الدليل · بحث · كيف نحسب