Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
IT Security NachrichtenOnePlus/OxygenOS: Schad-App erhält Root-Zugriff ohne Berechtigungen(24.09.2026 um 23:38 Uhr)
•
IT Security NachrichtenRyuk Member Karen Vardanyan Sentenced to Two Years in U.S. Prison(24.09.2026 um 22:50 Uhr)
•••••
Hacking & PentestingRyuk Member Karen Vardanyan Sentenced to Two Years in U.S. Prison(24.09.2026 um 22:50 Uhr)
•
AI & KI NachrichtenWhy the U.N. Still Matters(24.09.2026 um 23:00 Uhr)
•••
IT Security NachrichtenOnePlus/OxygenOS: Schad-App erhält Root-Zugriff ohne Berechtigungen(24.09.2026 um 23:38 Uhr)
•
IT Security NachrichtenRyuk Member Karen Vardanyan Sentenced to Two Years in U.S. Prison(24.09.2026 um 22:50 Uhr)
•••••
Hacking & PentestingRyuk Member Karen Vardanyan Sentenced to Two Years in U.S. Prison(24.09.2026 um 22:50 Uhr)
•
AI & KI NachrichtenWhy the U.N. Still Matters(24.09.2026 um 23:00 Uhr)
•••
Intelligence View
⚡ tsecurity.de Intelligence

A simple C++ algorithm to count the point in circle.

1.Introduction Now I'd like to introduce an algorithm called "Bingxi's Fish Algorithm", here is the statement. There are two-dimensional coordinate systems with x abscissa and y ordinate, BingXi's fish are distributed in the coordinate…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!




1.Introduction



Now I'd like to introduce an algorithm called "Bingxi's Fish Algorithm", here is the statement.




There are two-dimensional coordinate systems with x abscissa and y ordinate, BingXi's fish are distributed in the coordinate system, with a maximum of one fish per coordinate point. Let Bingxi's radius of influence be r, and the fish in this circle will become Bingxi's fish. When asked where BingXi was, he can get the largest number of fish.









2.Analysis



This problem is a single algorithm problem, which can be solved by enumeration. Start with the coordinates of each fish and check them one by one, and the method is as follows:

Step 1: Approximate positioning

Take the coordinates of each fish as the center of the circle, and R as the radius to make a circle, and record the coordinate points contained in the circle.

Step 2: Precise positioning

Make a circle with radius r around each circle position, and the range of the circle should contain the coordinates of the fish, the actual operation is to make a circle with radius r with the coordinate point in the circle as the center point of the circle and find out the circle that contains the most fish, the center coordinate of the circle is the one sought (there may be more than one coordinate that meets the conditions)



Now let's have a look of the algorithm requirements.



Input

The first line, a positive integer r, represents Bingxi's radius of influence.

The second row, a positive integer n, indicates the number of fish.

The next n rows, each with two values of x1 and y1, indicate the position of the fish in the coordinate system.



Output

Condition 1: There is only one matching coordinate.

Outputs the x, y values of the coordinates, as well as the number of fish that can be obtained.

Condition 2: There is more than one matching coordinate.

In the first row, the number of fish that can be obtained m

In the second row, the number of coordinate points z.

In the next z row, the x,y values of each coordinate point are output.



Numerical range

x∈[0, 2147483647], y∈[0, 2147483647], r∈[2, 10000], x, y, r∈N





3.Code design



Preparation




struct Fish //the stucture of the fish
{
int x;
int y;
};

Fish fish[100010]; //fish point
Fish Point[100010]; //The point of the answer

int num = 0; //the number of the "Point"
int sum = 0; //the fish number in the circle
int point_num = -1; //the max fish value that can get.
bool Repeat = false; //to ensure wether the answer point is repeated or not






Input




int r;
cin >> r;
int n;
cin >> n;
for (int i = 1; i <= n; i++) //input the fish point
{
cin >> fish[i].x;
cin >> fish[i].y;
}






Processing




for (int i = 1; i <= n; i++) //all of the fish point
{
//find the fish point in circle
for (int j = fish[i].y - r; j <= fish[i].y + r; j++) //y
{
if (j < 0)
{
continue;
}
for (int m = fish[i].x - r; m <= fish[i].x + r; m++) //x
{
if (m < 0)
{
continue;
}
int dis = (fish[i].x - m) * (fish[i].x - m) + (fish[i].y - j) * (fish[i].y - j);
if (dis <= r * r)
{
//Make a circle with the inner point of the circle as the center of the circle, and record the number of coordinate points in the circle
sum = 0;
for (int p = 1; p <= n; p++)
{
int di = (fish[p].x - m) * (fish[p].x - m) + (fish[p].y - j) * (fish[p].y - j);
if (di <= r * r)
{
sum++;
}
}
if (sum > point_num)
{
point_num = sum;
num = 0;
num++;
Point[num].x = m;
Point[num].y = j;
}
else if (sum == point_num)
{
for (int i = 1; i <= num; i++)
{
if (Point[num].x == m && Point[num].y == j)
{
Repeat = true;
}
}
if (Repeat == false) //to judge if repeat
{
num++;
Point[num].x = m;
Point[num].y = j;
}
else
{
Repeat = false;
}
}
}
}
}
}






Output




if (num == 1)
{
cout << Point[num].x << " " << Point[num].y << " " << point_num;
}
else if (num > 1)
{
cout << point_num << endl;
cout << num << endl;
for (int i = 1; i <= num; i++)
{
cout << Point[i].x << " " << Point[i].y << endl;
}
}
else
{
cout << "error";
}









4.End



This is an algorithm which I programed last year in September. I hope you will enjoy it.

CTI Threat Relationship Graph2 Knoten / 1 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
SOC Incident Playbook: Vulnerability Remediation & Verification
Syntax validiert (0 Fehler)
title: Detect Exploitation - A simple C++ algorithm to count the point in circle.
id: cc8b071d-660d-4a9e-aece-f132edadc231
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-24
logsource:
  category: network_connection
  product: any
detection:
  selection:
      CommandLine|contains:
        - 'exploit'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
Syntax validiert (0 Fehler)
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-24"
        description = "YARA Signature for "
    strings:
        $str = "A simple C++ algorithm to coun" ascii wide
    condition:
        any of them
}
Syntax validiert (0 Fehler)
index=security sourcetype IN ("cisco:asa", "pan:traffic", "zeek_conn", "suricata", "WinEventLog:Security")
("A simple C algorithm to count the point ")
| stats count earliest(_time) as first_seen latest(_time) as last_seen by src_ip, dest_ip, dest_host, signature
| eval first_seen=strftime(first_seen, "%Y-%m-%d %H:%M:%S"), last_seen=strftime(last_seen, "%Y-%m-%d %H:%M:%S")
| sort - count
Syntax validiert (0 Fehler)
message: "*A simple C algorithm to count the point *"
Syntax validiert (0 Fehler)
CommonSecurityLog
| where Message has "A simple C algorithm to count the point "
| summarize EventCount = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by SourceIP, DestinationIP, DestinationPort, Activity
| extend DetectionRule = "iShareStuff-CTI-Compiled"
| sort by EventCount desc
🎯
MITRE ATT&CK Matrix Navigator 14 Taktiken
Reconnaissance
-
Resource Development
-
Initial Access
Execution
Persistence
-
Privilege Escalation
Defense Evasion
Credential Access
-
Discovery
-
Lateral Movement
-
Collection
-
Command and Control
Exfiltration
-
Impact
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich A simple C++ algorithm to count the poin.... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

⚡ Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten A simple C++ algorithm to count the point in circle.

Thematisch verwandte Begriffe: simple, algorithm, count, point · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-81473 | Dell Rugged Control Center (RCC), versions prior to 5.2.206, contain an …
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel • Rechts: nächster Artikel • unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel TTP ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...
↗ Original-Quelle