程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> HDU 2841 Visible Trees£¨ÊýÂÛ£©

HDU 2841 Visible Trees£¨ÊýÂÛ£©

編輯:C++入門知識

HDU 2841 Visible Trees£¨ÊýÂÛ£©


ÌâÄ¿´óÒ⣺¸øÄãÒ»¸öm*nµÄ·½格£¬·½格´Ó£¨1£¬1£©¿ªÊ¼¡£Ã¿¸öµãÉÏÓÐÒ»¿ÃÊ÷£¬È»ºóÈÃÄã´Ó(0,0)µãÏòÏ¿´£¬ÎÊÄãÄÜ¿´¼û¼¸¿ÅÊ÷¡£

½âÌâ˼·£ºÈç¹ûÄãµÄÊÓÏß±»ºóÃæµÄÊ÷ºÍµ²×¡µÄ»°ÒÔºóÔÚÕâÌõÏßÉϵÄÊ÷ÄãÊǶ¼¿´²»¼ûµÄ°¡¡£µ²×¡µÄ»°¾ÍÊÇÕâ¸öСµÄ·½格ÄÚ¶Ô½ÇÏßµÄÁ¬Ïß¹ý¶¥µã£¬Èçͼ£º

\

½¨ÉèAΪ(0,0)Èç¹ûBÄÜÕÚµ²×¡C£¬ÄÇôBÓëC×é³ÉµÄ¾ØÐÎÖÐnx, mxÊDz»»¥Öʵġ£<†·Ÿ"http://www.Bkjia.com/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHA+y/nS1Hi00zG/qsq8w7a+2W7I57n7bdbQxLPSu8/u0+t4u6XWysTHw7S+zbvh09DSu7j2JiMyNjY4NDvX08/Uyr6z9sC0o6zL+dLU1eLA79Do0qrV0rXEyscxLW7W0NPrw7a+2bXEeLul1sq1xLj2yv2ho9XiwO+1xLuwztLDx7/J0tTTw7W9t9a94tbK0vLK/aOsyLu689PD17TMrNG5y/W9+NDQyN2z4qOsx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k91dHB1dAoKRm9yIGVhY2ggdGVzdCBjYXNlIG91dHB1dCBvbmUgbGluZSByZXByZXNlbnRzIHRoZSBudW1iZXIgb2YgdHJlZXMgRmFybWVyIFNoZXJsb2NrIGNhbiBzZWUuCgogCjxicj4KClNhbXBsZSBJbnB1dAoKPHByZSBjbGFzcz0="brush:java;">2 1 1 2 3
Sample Output

1
5
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#define eps 1e-8
#define M 1000100
#define LL long long
//#define LL long long
#define INF 0x3f3f3f
#define PI 3.1415926535898
#define mod 1000000007


const int maxn = 100010;

using namespace std;

struct node
{
    int num[8];
    int ans;
} p[maxn];

int f[maxn];
int k[maxn];
int t;
void prime()
{
    t = 0;
    memset(f, 0, sizeof(f));
    for(int i = 2; i <= maxn-5; i++)
    {
        if(!f[i]) k[t++] = i;
        for(int j = 0; j < t; j++)
        {
            if(i*k[j] > maxn-5) break;
            f[i*k[j]] = true;
            if(i%k[j] == 0) break;
        }
    }
}


LL judge(int n, int x)
{
    LL cnt = 0;
    for(int i = 0; i < (1<<(p[x].ans)); i++)
    {
        int ss = 0;
        int sx = 1;
        for(int j = 0; j < p[x].ans; j++)
        {
            if((1<>T;
    while(T--)
    {
        scanf("%d %d",&n, &m);
        LL sum = n;
        for(int i = 2; i <= m; i++) sum += judge(n, i);
        cout<

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved