第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

關(guān)于pta上面的一道題目有某個(gè)測試點(diǎn)不過求解答

關(guān)于pta上面的一道題目有某個(gè)測試點(diǎn)不過求解答

This time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world's most famous spy, was captured by a group of drug dealers. He was sent to a small piece of land at the center of a lake filled with crocodiles. There he performed the most daring action to escape -- he jumped onto the head of the nearest crocodile! Before the animal realized what was happening, James jumped again onto the next big head... Finally he reached the bank before the last crocodile could bite him (actually the stunt man was caught by the big mouth and barely escaped with his extra thick boot).Assume that the lake is a 100 by 100 square one. Assume that the center of the lake is at (0,0) and the northeast corner at (50,50). The central island is a disk centered at (0,0) with the diameter of 15. A number of crocodiles are in the lake at various positions. Given the coordinates of each crocodile and the distance that James could jump, you must tell him a shortest path to reach one of the banks. The length of a path is the number of jumps that James has to make.Input Specification:Each input file contains one test case. Each case starts with a line containing two positive integers?N?(≤100), the number of crocodiles, and?D, the maximum distance that James could jump. Then?N?lines follow, each containing the?(x,y)location of a crocodile. Note that no two crocodiles are staying at the same position.Output Specification:For each test case, if James can escape, output in one line the minimum number of jumps he must make. Then starting from the next line, output the position?(x,y)?of each crocodile on the path, each pair in one line, from the island to the bank. If it is impossible for James to escape that way, simply give him 0 as the number of jumps. If there are many shortest paths, just output the one with the minimum first jump, which is guaranteed to be unique.Sample Input 1:17 1510 -2110 21-40 1030 -5020 4035 100 -10-25 2240 -40-30 30-10 220 1125 2125 1010 1010 35-30 10Sample Output 1:40 1110 2110 35Sample Input 2:4 13-12 1212 12-12 -1212 -12Sample Output 2:0上面是題目 ?/////////////////下面是我的代碼//////////////////#include <stdio.h>#include <math.h>typedef struct {??? int x;??? int y;}Node;?Node data[101];int visited[101];int resultNow[101], resultMin[101];int v, r, countMin, countNow;?int DFS(int now, int index);?int main() {??? scanf("%d%d", &v, &r);??? countMin = 200;??? countNow = 0;??? for (int i = 0; i < v; i++) {???????? scanf("%d%d", &data[i].x, &data[i].y);??? }??? int mark = 0;??? if (r >= 35) {???????? printf("1\n");???????? return 0;??? }??? for (int i = 0; i < v; i++) {???????? if (pow(data[i].x, 2) + pow(data[i].y, 2) - 15 * 15 <= r*r)???????????? if (DFS(i, 0))????????????????? mark = 1;??? }???? if (mark) {???????? printf("%d\n", countMin + 1);???????? for (int i = 0; i < countMin; i++)???????????? printf("%d %d\n", data[resultMin[i]].x, data[resultMin[i]].y);??? }??? else???????? printf("0\n");??? return 0;}?int DFS(int now, int index) {??? visited[now] = 1;??? countNow++;??? resultNow[index] = now;??? if (50 - abs(data[now].x) <= r || 50 - abs(data[now].y) <= r) {//更新,要么找到更小的,要么第一跳距離更小???????? if (countNow < countMin || countNow == countMin&&pow(data[resultNow[0]].x, 2) + pow(data[resultNow[0]].y, 2) <???????????? pow(data[resultMin[0]].x, 2) + pow(data[resultMin[0]].y, 2)) {???????????? countMin = countNow;???????????? for (int i = 0; i < countMin; i++)????????????????? resultMin[i] = resultNow[i];???????? }???????? visited[now] = 0;???????? countNow--;???????? return 1;??? }??? int mark = 0;??? for (int i = 0; i < v; i++) {???????? if (!visited[i] && pow(data[now].x - data[i].x, 2) + pow(data[now].y - data[i].y, 2) <= r*r) {???????????? mark = DFS(i, index + 1);???????? }??? }??? visited[now] = 0;??? countNow--;??? if (mark)???????? return 1;??? else???????? return 0;}關(guān)于那個(gè)更新的我上面不是寫了嗎?為什么還不過。。。求大佬幫幫忙。。。。
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關(guān)注
  • 2800 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)