锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久精品99无色码中文字幕 ,久久av一区,91久久精品美女http://m.shnenglu.com/tianlearn-language/category/14031.html妗ユ鏄敱閽㈤搧宸ヤ漢寤洪犵殑錛岃屼笉鏄敱宸ョ▼甯堝緩閫犵殑銆? 鍚屾牱鍦幫紝杞歡鏄敱紼嬪簭浜哄憳緙栧啓鐨勶紝鑰屼笉鏄敱宸ョ▼甯堢紪鍐欑殑錛?/description>zh-cnFri, 13 Aug 2010 13:15:49 GMTFri, 13 Aug 2010 13:15:49 GMT60Ural 1028 starshttp://m.shnenglu.com/tianlearn-language/archive/2010/08/12/123249.html鐢板叺鐢板叺Thu, 12 Aug 2010 13:33:00 GMThttp://m.shnenglu.com/tianlearn-language/archive/2010/08/12/123249.htmlhttp://m.shnenglu.com/tianlearn-language/comments/123249.htmlhttp://m.shnenglu.com/tianlearn-language/archive/2010/08/12/123249.html#Feedback0http://m.shnenglu.com/tianlearn-language/comments/commentRss/123249.htmlhttp://m.shnenglu.com/tianlearn-language/services/trackbacks/123249.html
鏍?wèi)鐘舵暟缁勫Q?榪樹(shù)笉浼?xì)鐢ㄥQ屽嚑涔庣収鎶勫埆浜虹殑



#include
<iostream>
#include
<stdio.h>
using namespace std;
const int MAX_X=32001,MAX_N=15000;
int c[MAX_X+1]={0},sum[MAX_N+1]={0};
int n;
int lowbit(int x){ return x&(-x); }
void inc(int x)
{
     
while(x<=MAX_X)
     {
         c[x]
++;
         x
+=lowbit(x);
     }
}

int Sum(int x)
{
    
int ans=0;
    
while(x>=1)
    {
               ans
+=c[x];
               x
-=lowbit(x);
    }
    
return ans;
}
int main()
{
    
int x,y,i;
    cin
>>n;
    
for(i=1; i<=n; i++)
    {
             cin
>>x>>y;
             x
++; y++;
             sum[Sum(x)]
++;
             inc(x);
    }
    
for(i=0; i<n; i++)
             printf(
"%d\n",sum[i]);//cout<<sum[i]<<endl;
    system("pause");
    
return 0;
}



鐢板叺 2010-08-12 21:33 鍙戣〃璇勮
]]>
Ural 1060 Flip Gamehttp://m.shnenglu.com/tianlearn-language/archive/2010/07/31/121812.html鐢板叺鐢板叺Sat, 31 Jul 2010 13:44:00 GMThttp://m.shnenglu.com/tianlearn-language/archive/2010/07/31/121812.htmlhttp://m.shnenglu.com/tianlearn-language/comments/121812.htmlhttp://m.shnenglu.com/tianlearn-language/archive/2010/07/31/121812.html#Feedback0http://m.shnenglu.com/tianlearn-language/comments/commentRss/121812.htmlhttp://m.shnenglu.com/tianlearn-language/services/trackbacks/121812.html C++ Accepted
0.031 197 KB

1060. Flip Game

Time Limit: 2.0 second
Memory Limit: 16 MB
Flip game is played on a rectangular 4×4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the other one is black and each piece is lying either it's black or white side up. Each round you flip 3 to 5 pieces, thus changing the color of their upper side from black to white and vice versa. The pieces to be flipped are chosen every round according to the following rules:
  1. Choose any one of the 16 pieces.
  2. Flip the chosen piece and also all adjacent pieces to the left, to the right, to the top, and to the bottom of the chosen piece (if there are any).
Problem illustration
Consider the following position as an example:
bwbw
            wwww
            bbwb
            bwwb
            
Here "b" denotes pieces lying their black side up and "w" denotes pieces lying their white side up. If we choose to flip the 1st piece from the 3rd row (this choice is shown at the picture), then the field will become:
bwbw
            bwww
            wwwb
            wwwb
            
The goal of the game is to flip either all pieces white side up or all pieces black side up. You are to write a program that will search for the minimum number of rounds needed to achieve this goal.

Input

The input consists of 4 lines with 4 characters "w" or "b" each that denote game field position.

Output

Write to the output a single integer number 鈥?the minimum number of rounds needed to achieve the goal of the game from the given position. If the goal is initially achieved, then write 0. If it's impossible to achieve the goal, then write the word "Impossible" (without quotes).

Sample

input output
bwbw
            wwww
            bbwb
            bwwb
            
Impossible
            
Problem Source: 2000-2001 ACM Northeastern European Regional Programming Contest

wa浜?jiǎn)鍑爧?br>鍘熷洜錛?鏄痗nt鍙娌″噺
             2鏄痵earch鐨勬帹鍑烘潯浠跺啓鎴恑f(m==16){ ……}錛岃繖縐嶆儏鍐典笅瀵逛簬鍙敼鍙樻渶鍚庝竴涓嵆鍙緱鎯呭喌娌℃湁鍒ゅ畾銆傛敼鎴恗>16

#include<iostream>
using namespace std;
bool status[6][6]={0};
const int MAX=0x7fffffff;
int cnt=0,cntMin=MAX;        

bool check()
{
    
bool f=status[1][1];
    
int i,j;
    
for(i=1; i<=4; i++)
    
for(j=1; j<=4; j++)
       
if(f!=status[i][j])return false;
    
    
return true;
}

void turn(int i, int j)
{
     status[i][j]
=!status[i][j];
     status[i
-1][j]=!status[i-1][j];
     status[i
+1][j]=!status[i+1][j];
     status[i][j
-1]=!status[i][j-1];
     status[i][j
+1]=!status[i][j+1];
}

void input()
{
     
char ch;
     
for(int i=1; i<=4; i++)
     
for(int j=1; j<=4; j++)
     {
             cin
>>ch;
             status[i][j]
=(ch=='b' ? 0 : 1 );
     }


void search(int m)
{
        
if(m>16){
                 
if( check() && (cnt<cntMin) )cntMin=cnt;     
                 
return ;
        }
        
int i=(m+3)/4
        
int j=m-4*(i-1);
        
        turn(i,j); cnt
++;
        search(m
+1);
        
        turn(i,j);cnt
--;
        search(m
+1);   
}

int main()
{
    input();   
    search(
1);
    
if(cntMin==MAX)cout<<"Impossible"<<endl;
    
else cout<<cntMin<<endl;
    system(
"pause");
    
return 0;
}


鐢板叺 2010-07-31 21:44 鍙戣〃璇勮
]]>
Ural 1080 Map Colouringhttp://m.shnenglu.com/tianlearn-language/archive/2010/07/31/121796.html鐢板叺鐢板叺Sat, 31 Jul 2010 09:17:00 GMThttp://m.shnenglu.com/tianlearn-language/archive/2010/07/31/121796.htmlhttp://m.shnenglu.com/tianlearn-language/comments/121796.htmlhttp://m.shnenglu.com/tianlearn-language/archive/2010/07/31/121796.html#Feedback0http://m.shnenglu.com/tianlearn-language/comments/commentRss/121796.htmlhttp://m.shnenglu.com/tianlearn-language/services/trackbacks/121796.html

1080. Map Colouring

Time Limit: 1.0 second
Memory Limit: 16 MB
We consider a geographical map with N countries numbered from 1 to N (0 < N < 99). For every country we know the numbers of other countries which are connected with its border. From every country we can reach to any other one, eventually crossing some borders. Write a program which determines whether it is possible to colour the map only in two colours 鈥?red and blue in such a way that if two countries are connected their colours are different. The colour of the first country is red. Your program must output one possible colouring for the other countries, or show, that such colouring is impossible.

Input

On the first line is written the number N. On the following N lines, the i-th line contains the countries to which the i-th country is connected. Every integer on this line is bigger than i, except the last one which is 0 and marks that no more countries are listed for country i. If a line contains 0, that means that the i-th country is not connected to any other country, which number is larger than i.

Output

The output contains exactly one line. If the colouring is possible, this line must contain a list of zeros and ones, without any separators between them. The i-th digit in this sequence is the colour of the i-th country. 0 corresponds to red colour, and one 鈥?to blue colour. If a colouring is not possible, output the integer −1.

Sample

input output
3
                        2 0
                        3 0
                        0
                        
010
                        

DFS:鎴朆FS錛屾垨鑰呭茍鏌ラ泦錛堜笉浼?xì)鐢ㄥQ?/pre>
榪欓噷鐢ㄧ殑DFS錛岀敤涓涓爣璁版暟緇勶紝娌¤繘鍏ヤ竴涓仈閫氬垎鍥懼悗錛屾爣璁頒負(fù)0錛堣〃紺轟竴縐嶉鑹詫級(jí)涓庡畠鐩歌繛鐨勬爣璁頒負(fù)1錛堝彟涓縐嶉鑹詫級(jí)錛?/pre>
鐒跺悗涓?鐩歌繛鐨勫湪鏍囪涓?銆?榪欓噷鐨勬爣璁伴兘鏄娌℃湁鏍囪榪囩殑榪涜鐨勶紝濡傛灉鏄爣璁拌繃鐨勶紝灝辮媯(gè)鏌ヤ粬浠殑鏍囪鏄惁鐩稿悓
濡傛灉鐩稿悓鍒欒鏄庯紝浠栦滑鍚岃壊銆?br>
//ural 1080
#include<iostream>
using namespace std;

const int MAX=100;
bool adj[MAX][MAX];
int flg[MAX];
int n;
bool isPossible=true;

void input()
{
     cin
>>n;
     
int temp;
     
for(int i=1; i<=n; i++)
     {
             
while(cin>>temp,temp!=0)
             {
                                     adj[i][temp]
=adj[temp][i]=true;
             }
     }
}

void dfs(int i)
{
     
if(isPossible==false)return ;
     
if(flg[i]==-1)flg[i]=0;
     
for(int j=1; j<=n; j++)
     {
             
if(adj[i][j])
             {
                          
if(flg[j]==-1){ flg[j]=flg[i]==0? 1:0;  dfs(j); } 
                          
else if(flg[j]==flg[i])isPossible=false;
                          
             }
     }
     
}

int main()
{
    memset(adj,
0,sizeof adj);
    
    input();
    
for(int i=1; i<=n; i++
           flg[i]
=-1;  
    
    flg[
1]=0;
    
for(int i=1; i<=n; i++)
            dfs(i);
    
    
if(isPossible==false)cout<<-1<<endl;
    
else { 
         
for(int k=1; k<=n; k++)
             cout
<<flg[k];
         cout
<<endl;
           }
             
    
    system(
"pause");
    
return 0;
}


鐢板叺 2010-07-31 17:17 鍙戣〃璇勮
]]>Ural 1008 Image encodinghttp://m.shnenglu.com/tianlearn-language/archive/2010/06/26/118798.html鐢板叺鐢板叺Sat, 26 Jun 2010 14:38:00 GMThttp://m.shnenglu.com/tianlearn-language/archive/2010/06/26/118798.htmlhttp://m.shnenglu.com/tianlearn-language/comments/118798.htmlhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/26/118798.html#Feedback0http://m.shnenglu.com/tianlearn-language/comments/commentRss/118798.htmlhttp://m.shnenglu.com/tianlearn-language/services/trackbacks/118798.html

1008. Image encoding

Time Limit: 2.0 second
Memory Limit: 16 MB
Problem illustration
There are several ways to encode an image. In this problem we will consider two representations of an image. We assume that the image consists of black and white pixels. There is at least one black pixel and all black pixels are connected with their sides. Coordinates of black pixels are not less than 1 and not greater than 10. An example of such an image is at the figure.
Both representations describe arrangement of black pixels only.
At the first representation we specify in the first line number of black pixels and coordinates of each black pixel in the following lines. Pixels are listed in order of increasing X. In case of equality of X they are listed in order of increasing Y. Image at the figure is encoded as follows:
6
2 3
2 4
3 3
3 4
4 2
4 3
At the second representation we specify in the first line coordinates of the lowest left black pixel. Each of the following lines contains a description of neighbors for one of the pixels. At first, neighbors of the lowest left pixel are specified, then neighbors of its first neighbor (if it exists) are specified, then neighbors of its second neighbor (if it also exists) follow. When all its neighbors are described the description of the neighbors of its first neighbor follows. The description of the neighbors of its second neighbor follows then and so on.
Each descriptive line contains at most one letter for each neighbor: R for the right, T for the top, L for the left, B for the bottom. If the neighbor was already specified it is not included into the descriptive line and vice-versa. Also there is only one descriptive line for each pixel. Neighbors are listed counter-clockwise starting with the right. Each descriptive line except the last ends with a comma. The last line ends with a full stop. Image at the figure is encoded as follows:
2 3
RT,
RT,
,
B,
,
.
There are no leading or tailing spaces in any representation. There is exactly one space between X and Y coordinates.

Input

One representation of the image will be given to your program in the input.

Output

Your program has to write other representation of the image to the output.

Sample

input output
6
            2 3
            2 4
            3 3
            3 4
            4 2
            4 3
            
2 3
            RT,
            RT,
            ,
            B,
            ,
            .
            
Problem Source: Third Open USTU Collegiate Programming Contest (PhysTech Cup), March 18, 2000

榪欓鑺變簡(jiǎn)涓嶅皯鏃墮棿錛岄鐩病鐪嬫竻錛屽彧鐪嬬ず渚嬩互涓哄彧瑕佷粠絎竴縐嶆柟妗堣漿鎹㈡垚絎簩縐嶏紝娌℃兂鍒拌繕鏈変粠絎簩縐嶈漿鎹㈡垚絎竴縐?br>BFS錛?
Accepted     
0.015        217 KB

#include<iostream>
#include
<queue>
#include
<string.h>
#include
<string>
using  namespace std;

typedef 
struct point
{
int x,y; } point;

bool graph[12][12]={0};
bool f[12][12]={0};
bool print[12][12]={0};

int n;
int lbx=10,lby=10;
              
void input()
{
     
int x,y;
     
for(int i=1; i<=n; i++)
         {
              cin
>>x>>y; graph[x][y]=1;
              
if(x<lbx){ lbx=x; lby=y; }
              
else if(x==lbx&&y<lby)
                    lby
=y;
         }
}

void BFS1()    //鏁板瓧鎯呭喌 
{
     queue
<point> q;
     point temp; temp.x
=lbx; temp.y=lby;
     cout
<<lbx<<' '<<lby<<endl;
     q.push(temp);
     
int x,y; int cnt=0;
     print[lbx][lby]
=1;
     
while(q.size())
     {
              temp
=q.front(); q.pop();
              x
=temp.x; y=temp.y;
              
if(f[x][y]==1)continue;
              f[x][y]
=1;
              
if(graph[x+1][y]==1&&!f[x+1][y])
{
if(!print[x+1][y]) cout<<'R'; print[x+1][y]=1; temp.x=x+1;temp.y=y; q.push(temp);}
              
if(graph[x][y+1]==1&&!f[x][y+1])
{
if(!print[x][y+1]) cout<<'T'; print[x][y+1]=1; temp.x=x;temp.y=y+1; q.push(temp);}
              
if(graph[x-1][y]==1&&!f[x-1][y])
{
if(!print[x-1][y]) cout<<'L'; print[x-1][y]=1; temp.x=x-1;temp.y=y; q.push(temp);}
              
if(graph[x][y-1]==1&&!f[x][y-1])
{
if(!print[x][y-1]) cout<<'B'; print[x][y-1]=1; temp.x=x;temp.y=y-1; q.push(temp);}
              
++cnt;
              
if(cnt==n) cout<<'.'<<endl;
               
else  cout <<','<<endl;
     }
}

void BFS2()  // 浠嶳 T L B鎻忚堪杞崲鎴愬潗鏍?/span>
{
     lbx
=n; cin>>lby;
     queue
<point>q;
     point temp; temp.x
=lbx; temp.y=lby;
     q.push(temp);
     
string str; int x,y;
     graph[lbx][lby]
=1;
     
while(q.size())
     {
       
        temp
=q.front(); q.pop();
        x
=temp.x; y=temp.y;
        
if(f[x][y])continue;
        f[x][y]
=1;
        cin
>>str;
        
for(int i=0; i<str.size()-1; i++)
        {
                
if(str[i]=='R')     {graph[x+1][y]=1if(!f[x+1][y]){ temp.x=x+1; temp.y=y; q.push(temp);} }
                
else if(str[i]=='T'){graph[x][y+1]=1if(!f[x][y+1]){ temp.x=x; temp.y=y+1; q.push(temp);} }
                
else if(str[i]=='L'){graph[x-1][y]=1if(!f[x-1][y]){ temp.x=x-1; temp.y=y; q.push(temp);} }
                
else if(str[i]=='B'){graph[x][y-1]=1;if(!f[x][y-1]){ temp.x=x; temp.y=y-1; q.push(temp);} }
        }
        
if(str[str.size()-1]=='.')break;
     }
     
int cnt=0;
     
for(int i=1; i<=10; i++)
     
for(int j=1; j<=10; j++)
     
if(graph[i][j])cnt++;
     cout
<<cnt<<endl;
     
for(int i=1; i<=10; i++)
     
for(int j=1; j<=10; j++)
     
if(graph[i][j])cout<<i<<' '<<j<<endl;   
}

int main()
{
    cin
>>n;
    
if(getchar()=='\n')
    {
    input(); 
    BFS1();
    }
    
else BFS2();
    system(
"pause");
    
return 0;
}


鐢板叺 2010-06-26 22:38 鍙戣〃璇勮
]]>
Ural 1048 Superlong sumshttp://m.shnenglu.com/tianlearn-language/archive/2010/06/25/118695.html鐢板叺鐢板叺Fri, 25 Jun 2010 03:31:00 GMThttp://m.shnenglu.com/tianlearn-language/archive/2010/06/25/118695.htmlhttp://m.shnenglu.com/tianlearn-language/comments/118695.htmlhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/25/118695.html#Feedback0http://m.shnenglu.com/tianlearn-language/comments/commentRss/118695.htmlhttp://m.shnenglu.com/tianlearn-language/services/trackbacks/118695.html

1048. Superlong sums

Time Limit: 2.0 second
Memory Limit: 16 MB
The creators of a new programming language D++ have found out that whatever limit for SuperLongInt type they make, sometimes programmers need to operate even larger numbers. A limit of 1000 digits is so small… You have to find the sum of two numbers with maximal size of 1 000 000 digits.

Input

The first line contains a single number N (1 ≤ N ≤ 1 000 000) 鈥?the length of the integers (in order to make their lengths equal, some leading zeroes can be added). It is followed by these integers written in columns. That is, the next N lines contain two digits each, divided by a space. Each of the two given integers is not less than 1, and the length of their sum does not exceed N.

Output

Output exactly N digits in a single line representing the sum of these two integers.

Sample

input output
4
            0 4
            4 2
            6 8
            3 7
            
4750
Problem Author: Stanislav Vasilyev and Alexander Klepinin
Problem Source: Ural State University collegiate programming contest (25.03.2000)

綆鍗曞ぇ鏁板姞娉?br>
#include<iostream>
using namespace std;
int a[1000005]={0};
int b[1000005]={0};
int ans[1000005]={0};
int main()
{
    int N,i,c=0;
    cin>>N;
    for(i=1; i<=N; i++)
             cin>>a[i]>>b[i];
    for(i=N; i>=1; i--)
     {
             ans[i]=(a[i]+b[i]+c)%10;
             c=(a[i]+b[i]+c)/10;
     }
     
     for(i=1  ; i<=N; i++)
     cout<<ans[i];
     cout<<endl;
     system("pause");
    return 0;
}


鐢板叺 2010-06-25 11:31 鍙戣〃璇勮
]]>
Ural 1047 Simple calculationshttp://m.shnenglu.com/tianlearn-language/archive/2010/06/24/118673.html鐢板叺鐢板叺Thu, 24 Jun 2010 15:09:00 GMThttp://m.shnenglu.com/tianlearn-language/archive/2010/06/24/118673.htmlhttp://m.shnenglu.com/tianlearn-language/comments/118673.htmlhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/24/118673.html#Feedback0http://m.shnenglu.com/tianlearn-language/comments/commentRss/118673.htmlhttp://m.shnenglu.com/tianlearn-language/services/trackbacks/118673.html

1047. Simple calculations

Time Limit: 1.0 second
Memory Limit: 16 MB
There is a sequence of N + 2 elements a0, a1, …, aN+1 (1 ≤ N ≤ 3000, −2000 ≤ ai ≤ 2000). It is known that
ai = (ai−1 + ai+1)/2 − ci
for each i = 1, 2, …, N.
You are given a0, aN+1, c1, …, cN. Write a program which calculates a1.

Input

The first line contains an integer N. The next two lines consist of numbers a0 and aN+1 each having two digits after decimal point, and the next N lines contain numbers ci (also with two digits after decimal point), one number per line.

Output

Output a1 in the same format as a0 and aN+1.

Sample

input output
1
                        50.50
                        25.50
                        10.15
                        
27.85
                        
Problem Author: Dmitry Filimonenkov
Problem Source: Ural State University collegiate programming contest (25.03.2000)

   鐢ㄦ暟瀛︽柟娉曟帹鍑哄叕寮忓嵆鍙細(xì)
     
 
//ural1047
//a1=( aN_1 +N*a0 -2*( (c1+……cN)+ (c1+……cN-1 ) +……(c1+c2)+(c1) ))/(N+1)
#include<iostream>
using namespace std;
double ci[3010]={0};  //ci[i]=c1+c2+……ci
int main()
{
   
int N,i;
   
double a0,aN_1,temp,sum=0;
   cin
>>N>>a0>>aN_1;
   
for(i=1; i<=N; i++)
   {
       cin
>>temp; 
       ci[i]
=ci[i-1]+temp;
       sum
+=ci[i];
   }

   sum
*=2;

   cout.precision(
2);
   cout
<<fixed<<( aN_1+ N*a0 -sum)/(N+1)<<endl;

   system(
"pause");
    
return 0;
}


鐢板叺 2010-06-24 23:09 鍙戣〃璇勮
]]>
Ural 1033 Labyrinthhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/24/118672.html鐢板叺鐢板叺Thu, 24 Jun 2010 15:02:00 GMThttp://m.shnenglu.com/tianlearn-language/archive/2010/06/24/118672.htmlhttp://m.shnenglu.com/tianlearn-language/comments/118672.htmlhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/24/118672.html#Feedback0http://m.shnenglu.com/tianlearn-language/comments/commentRss/118672.htmlhttp://m.shnenglu.com/tianlearn-language/services/trackbacks/118672.html Accepted
0.015 217 KB

1033. Labyrinth

Time Limit: 1.0 second
Memory Limit: 16 MB
Administration of the labyrinth has decided to start a new season with new wallpapers. For this purpose they need a program to calculate the square of the walls inside the labyrinth. This job is just for you!
The labyrinth is represented by a matrix N×N (3 ≤ N ≤ 33, you see, ‘3’ is a magic digit!). Some matrix cells contain a dot character (‘.’) that denotes an empty square. Other cells contain a diesis character (‘#’) that denotes a square filled by monolith block of stone wall. All squares are of the same size 3×3 meters.
The walls are constructed around the labyrinth (except for the upper left and lower right corners, which are used as entrances) and on the cells with a diesis character. No other walls are constructed. There always will be a dot character at the upper left and lower right corner cells of the input matrix.
Problem illustration
Your task is to calculate the square of visible part of the walls inside the labyrinth. In other words, the square of the walls' surface visible to a visitor of the labyrinth. Note that there's no holes to look or to move through between any two adjacent blocks of the wall. The blocks are considered to be adjacent if they touch each other in any corner. See picture for an example: visible walls inside the labyrinth are drawn with bold lines. The height of all the walls is 3 meters.

Input

The first line of the input contains the single number N. The next N lines contain N characters each. Each line describes one row of the labyrinth matrix. In each line only dot and diesis characters will be used and each line will be finished with a new line character. There will be no spaces in the input.

Output

Your program should print to the output a single integer 鈥?the exact value of the square of the wallpaper needed.

Sample

input output
5
            .....
            ...##
            ..#..
            ..###
            .....
            
198
            

鎼滅儲(chǔ)棰橈細(xì)娉ㄦ剰鐨勮浠庝袱涓叆鍙e鎼滅儲(chǔ)錛岄槻姝腑闂存柇寮浜?br>wa浜?jiǎn)涓?鎵句笉鍑洪敊璇紝search(i+1錛宩)鍐欐垚search(i+1,j+1)錛?br>
#include<iostream>
#include
<cstring>
using namespace std;

int const maxSize=35;

class ural1033
{
public:
    ural1033(){ size
=0; memset(f,0,sizeof f); }
    
void input();
    
void print();
    
void search(int i, int j);
    
int size;
    
int getn(){return N;}
private:
    
char a[maxSize][maxSize];
    
bool f[maxSize][maxSize];
    
int N;
};

void ural1033::input()
{
     cin
>>N;
     
int i,j;
     
for(i=1; i<=N; i++)
        
for(j=1; j<=N; j++)
            cin
>>a[i][j];
    
for(i=2; i<=N+1; i++)a[0][i]='#';
    
for(i=2; i<=N+1; i++)a[i][0]='#';
    
for(i=1; i<=N-1; i++)a[N+1][i]='#';
    
for(i=1; i<=N-1; i++)a[i][N+1]='#';

}

void ural1033:: search(int i, int j)
{
    
if(i<1||i>N||j<1||j>N||a[i][j]=='#'||f[i][j]==1)return ;
    f[i][j]
=1;
    
if(a[i-1][j]=='#')size++;
       
else search(i-1,j);
    
if(a[i][j-1]=='#')size++;
       
else search(i,j-1);
    
if(a[i][j+1]=='#')size++;
       
else search(i,j+1);
    
if(a[i+1][j]=='#')size++;
       
else search(i+1,j);
}

void ural1033::print()
{
     
for(int i=0; i<=N+1; i++,cout<<endl)
     
for(int j=0; j<=N+1; j++)
     cout
<<a[i][j]<<' ';
     cout
<<endl<<endl;
     
     
for(int i=0; i<=N+1; i++,cout<<endl)
     
for(int j=0; j<=N+1; j++)
     cout
<<f[i][j]<<' ';
}

int main()
{
    ural1033 ural;
    ural.input();
    
    ural.search(
1,1);
    ural.search(ural.getn(),ural.getn());
    
    cout
<<ural.size*9<<endl;
    
    system(
"pause");
    
return 0;
}



鐢板叺 2010-06-24 23:02 鍙戣〃璇勮
]]>
Ural 1044 Lucky tickets. Easy!http://m.shnenglu.com/tianlearn-language/archive/2010/06/23/118594.html鐢板叺鐢板叺Wed, 23 Jun 2010 15:36:00 GMThttp://m.shnenglu.com/tianlearn-language/archive/2010/06/23/118594.htmlhttp://m.shnenglu.com/tianlearn-language/comments/118594.htmlhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/23/118594.html#Feedback0http://m.shnenglu.com/tianlearn-language/comments/commentRss/118594.htmlhttp://m.shnenglu.com/tianlearn-language/services/trackbacks/118594.html
#include<iostream>
using namespace std;

void f2()
{
     
int count=0;
     
for(int i1=0; i1<=9; i1++)
     
for(int i2=0; i2<=9; i2++)
             
if(i1==i2)count++;
     cout
<<count<<endl;
}

void f4()
{
     
int count=0;
     
for(int i1=0; i1<=9; i1++)
     
for(int i2=0; i2<=9; i2++)
     
for(int i3=0; i3<=9; i3++)
     
for(int i4=0; i4<=9; i4++)
             
if(i1+i2==i3+i4)count++;
     cout
<<count<<endl;
}

void f6()
{
     
int count=0;
     
for(int i1=0; i1<=9; i1++)
     
for(int i2=0; i2<=9; i2++)
     
for(int i3=0; i3<=9; i3++)
     
for(int i4=0; i4<=9; i4++)
     
for(int i5=0; i5<=9; i5++)
     
for(int i6=0; i6<=9; i6++)
             
if(i1+i2+i3==i5+i4+i6)count++;
     cout
<<count<<endl;
}

void f8()
{
     
int count=0;
     
for(int i1=0; i1<=9; i1++)
     
for(int i2=0; i2<=9; i2++)
     
for(int i3=0; i3<=9; i3++)
     
for(int i4=0; i4<=9; i4++)
     
for(int i5=0; i5<=9; i5++)
     
for(int i6=0; i6<=9; i6++)
     
for(int i7=0; i7<=9; i7++)
     
for(int i8=0; i8<=9; i8++)
             
if(i1+i2+i3+i4==i5+i7+i6+i8)count++;
     cout
<<count<<endl;
}

int main()
{
    
int n;
    cin
>>n;
    
if(n==2)f2();
    
else if(n==4)f4();
    
else if(n==6)f6();
    
else if(n==8)f8();
    
    system(
"pause");
    
return 0;
}


鐢板叺 2010-06-23 23:36 鍙戣〃璇勮
]]>
Ural 1010 Discrete Functionhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/23/118589.html鐢板叺鐢板叺Wed, 23 Jun 2010 15:09:00 GMThttp://m.shnenglu.com/tianlearn-language/archive/2010/06/23/118589.htmlhttp://m.shnenglu.com/tianlearn-language/comments/118589.htmlhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/23/118589.html#Feedback0http://m.shnenglu.com/tianlearn-language/comments/commentRss/118589.htmlhttp://m.shnenglu.com/tianlearn-language/services/trackbacks/118589.html//鏂滅巼鏈澶х殑鐐逛竴瀹氭槸鐩擱偦鐨勶紝鐩存帴閬嶅巻涓閬嶅嵆鍙?br>#include<iostream>
using namespace std;

double a[100005];

double abs(double a)
{
       
return a>0?a:-a;
}
int main()
{
    
int n,i,x=2;
    
    
double xl;
    cin
>>n;
    
for(i=1; i<=n; i++)
      cin
>>a[i];
      
     xl
=abs(a[2]-a[1]);
     
     
for(i=3; i<=n; i++)
     {
              
if(abs(a[i]-a[i-1])>xl)
              {
                   x
=i;
                   xl
=abs(a[i]-a[i-1]);
              }
     }
     
     cout
<<x-1<<' '<<x<<endl;
      
      system(
"pause");
    
    
return 0;
}


鐢板叺 2010-06-23 23:09 鍙戣〃璇勮
]]>
Ural 棰樼洰鍒嗙被 銆愯漿銆?/title><link>http://m.shnenglu.com/tianlearn-language/archive/2010/06/22/118504.html</link><dc:creator>鐢板叺</dc:creator><author>鐢板叺</author><pubDate>Tue, 22 Jun 2010 14:14:00 GMT</pubDate><guid>http://m.shnenglu.com/tianlearn-language/archive/2010/06/22/118504.html</guid><wfw:comment>http://m.shnenglu.com/tianlearn-language/comments/118504.html</wfw:comment><comments>http://m.shnenglu.com/tianlearn-language/archive/2010/06/22/118504.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.shnenglu.com/tianlearn-language/comments/commentRss/118504.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/tianlearn-language/services/trackbacks/118504.html</trackback:ping><description><![CDATA[<p style="FONT-SIZE: 12pt; FONT-FAMILY: Verdana">棰樺彿   鏍囬    闅懼害緋繪暟    綆楁硶 <br>1000 A+B Problem 10% 鐩存帴鍔?<br>1002 Phone Numbers 50% 鍔ㄦ佽鍒掓垨鏈鐭礬 <br>1003 Parity 70% 鍖洪棿鍑忔硶 <br>1004 Sightseeing trip 60% 鏈鐭礬 <br>1005 Stone Pile 30% 鍔ㄦ佽鍒掓垨鎼滅儲(chǔ) <br>1006 Square Frames 35% 妯℃嫙 <br>1007 Code Words 30% 妯℃嫙 <br>1008 Image encoding 30% 騫垮害浼樺厛鎼滅儲(chǔ) <br>1009 K-Based Numbers 20% 閫掓帹鎴栨灇涓撅紙鏁版嵁瑙勬ā灝忥級(jí) <br>1010 Discrete Function 40% 璐績(jī) <br>1011 Conductors 25% 鎼滅儲(chǔ) <br>1012 K-Based Numbers 30% 閫掓帹 <br>1013 K-Based Numbers 33% 閫掓帹 <br>1014 The Product of Digits 30% 璐績(jī) <br>1015 Test the differences 35% 妯℃嫙 <br>1016 A cube on the walk 50% 鎼滅儲(chǔ)鎴栬呮渶鐭礬 <br>1017 The Staircases 30% 閫掓帹錛堟瘝鍑芥暟錛?<br>1018 The Binary Apple Tree 50% 鍔ㄦ佽鍒?<br>1019 A Line painting 40% 紱繪暎鍖栧鐞?<br>1020 Rope 45% 涓鑸殑璁$畻鍑犱綍闂 <br>1021 Sacrament of the sum 40% 鍔ㄦ佽鍒?<br>1022 Genealogical Tree 30% 鎷撹ˉ鎺掑簭 <br>1023 Buttons 50% 鍔ㄦ佽鍒?<br>1024 Permutations 25% 緗崲錛堝拰棰樼洰鍚嶅瓧涓鏍鳳級(jí) <br>1025 Democracy in Danger 20% 璐績(jī) <br>1026 Questions and Answers 40% 蹇熸帓搴?<br>1027 D++ again 40% 瀛楃涓插鐞?<br>1028 Stars 75% 綰挎鏍?<br>1029 Ministry 55% 鍔ㄦ佽鍒掞紙娉ㄦ剰浼樺寲錛?<br>1030 Titanic 60% 璁$畻鍑犱綍錛堟敞鎰忕簿搴︼紒錛?<br>1031 Railway Tickets 45% 鍔ㄦ佽鍒?<br>1032 Find a mutilple 55% 鍚屼綑闂 <br>1033 Labyrinth 30% 鎼滅儲(chǔ)銆侀亶鍘?<br>1034 Queens in peaceful positions 35% 鎼滅儲(chǔ) <br>1035 Cross-sitich 60% 嬈ф媺璺緞闂 <br>1036 Lucky tickets 50% 閫掓帹 <br>1037 Memory Management 55% 妯℃嫙錛堟敞鎰忎紭鍖栵級(jí) <br>1038 Spell Checker 45% 瀛楃涓茬殑鎿嶄綔鍙?qiáng)缁熻?<br>1039 Anniversary party 40% 鏍?wèi)鐨勫姩鎬佽鍒?<br>1040 Airline company 55% 鎼滅儲(chǔ) <br>1041 Nikifor 85% 綰挎т唬鏁伴棶棰?br>錛堣繃浜?jiǎn)锛屼絾鎬鐤戠畻娉曚笉瀵癸級(jí) <br>1042 Central Heating 50% 瑙g嚎鎬у悓浣欐柟紼嬬粍 <br>1043 Cover an Arc. 58% 璁$畻鍑犱綍 <br>1044 Lucky tickets 40% 閫掓帹 <br>1045 A funny game 55% 鎼滅儲(chǔ) <br>1046 Geometrical dreams 88% 寰堝鏉傜殑璁$畻鍑犱綍 <br>1047 Simple calculations 30% 鏁板棰橈紝瑙f柟紼嬪惂錛?<br>1048 Superlong Sums 48% 楂樼簿搴﹀姞娉?<br>1049 Brave ballonists 30% 妯℃嫙 <br>1050 Preparing an article 63% 姣旇緝楹葷儲(chǔ)鐨勫瓧絎︿覆澶勭悊 <br>1051 A simple game on a grid 60% 鏁板鏉傞 <br>1052 Rabbit Hunt 28% 綆鍗曠殑璁$畻鍑犱綍 <br>1053 Pinocchio 32% 姹傛渶澶у叕綰︽暟錛堥鐩剰鎬濅笉鏄庯級(jí) <br>1054 Hanoi Tower 50% 鏁板闂 <br>1055 Combinations 40% 鏁板闂 <br>1056 Computer net 55% 鍔ㄦ佽鍒?<br>1057 Amount of dergess 53% 鏁板闂 <br>1058 Chocolate 85% 澶嶆潅鐨勮綆楀嚑浣曢棶棰?<br>1059 Expression 20% 綆鍗曠殑鎵撳嵃闂 <br>1060 Flip game 35% 鎴戞悳绱紝榪囦簡(jiǎn) <br>1061 Buffer Manager 45% 妯℃嫙 <br>1062 Triathlon 83% 澶嶆潅鐨勪笉絳夊紡闂 <br>1064 Binary Search 48% 鎼滅儲(chǔ) <br>1065 Frontier 75% 鍔ㄦ佽鍒?<br>1066 Garland 40% 鏁板闂 <br>1067 Disk Tree 45% 妯℃嫙鎴栨帓搴?<br>1068 Sum 20% 綆鍗曠殑鍔犳硶棰?<br>1069 The prufer code 50% 鏋勯?<br>1070 A local time 60% 鑰冭檻瑕佸懆鍏?<br>1071 Nikifor - 2 45% 鎼滅儲(chǔ) <br>1072 Routing 40% 鏈鐭礬闂 <br>1073 A square problem 50% 鍔ㄦ佽鍒?<br>1074 A very short problem 58% 妯℃嫙銆佸垽鏂?<br>1075 A thread in the space 65% 楹葷儲(chǔ)鐨勮綆楀嚑浣?<br>1076 Trash 50% 浜屽垎鍥劇殑鏈澶ф潈鍖歸厤 <br>1077 Travelling Tours 60% 鍥劇殑閬嶅巻 <br>1078 Segments 40% 鍔ㄦ佽鍒?<br>1079 Maxium 50% 鏁板闂 <br>1080 Map coloring 35% 娣卞害浼樺厛鎼滅儲(chǔ) <br>1081 Binary Lexicographic Sequence 40% 鏁板闂 <br>1082 Gaby Ivanushka 15% 娌℃湁綆楁硶錛岀洿鎺ヨ緭鍑虹瓟妗?<br>1083 Factorials!!! 25% 綆鍗曠殑鏁板璁$畻 <br>1084 A goat in a kitchen garden 35% 綆鍗曠殑璁$畻鍑犱綍 <br>1085 Meeting 55% 鏈鐭礬 <br>1086 Cryptography 45% 鏁板闂 <br>1087 The time to take stones 48% 閫掓帹 <br>1088 Ilya Murumetz 33% 浜屽弶鏍?wèi)鐨勬ц川 <br>1089 verification with a vocabulary 50% 瀛楃涓插鐞?<br>1090 In the army now 60% 騫寵 浜屽弶鏍?<br>1091 Tmutarakan exams 57% 榪愮敤瀹規(guī)枼鍘熺悊 <br>1092 Transversal 75% 璐績(jī) <br>1093 Darts 65% 绔嬩綋瑙f瀽鍑犱綍 <br>1094 E-screen 40% 瀛楃涓插鐞?<br>1095 Nikifor - 3 45% 鍚屼綑闂 <br>1096 Get the right route plate! 40% 騫垮害浼樺厛鎼滅儲(chǔ) <br>1097 Square country - 2 63% 紱繪暎鍖栧鐞?<br>1098 Questions 48% 瀛楃涓插鐞?<br>1099 Work scheduling 60% 鍥劇殑鏈澶у熀鏁板尮閰?/p> <p style="FONT-SIZE: 12pt; FONT-FAMILY: Verdana">鏈枃鏉ヨ嚜CSDN鍗氬錛岃漿杞借鏍囨槑鍑哄錛?a >http://blog.csdn.net/nash635/archive/2010/03/22/5402820.aspx</a></p> <img src ="http://m.shnenglu.com/tianlearn-language/aggbug/118504.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/tianlearn-language/" target="_blank">鐢板叺</a> 2010-06-22 22:14 <a href="http://m.shnenglu.com/tianlearn-language/archive/2010/06/22/118504.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Ural 1026 Questions and answershttp://m.shnenglu.com/tianlearn-language/archive/2010/06/22/118500.html鐢板叺鐢板叺Tue, 22 Jun 2010 13:40:00 GMThttp://m.shnenglu.com/tianlearn-language/archive/2010/06/22/118500.htmlhttp://m.shnenglu.com/tianlearn-language/comments/118500.htmlhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/22/118500.html#Feedback0http://m.shnenglu.com/tianlearn-language/comments/commentRss/118500.htmlhttp://m.shnenglu.com/tianlearn-language/services/trackbacks/118500.html//鐪嬫噦棰樼洰灝變細(xì)浜?br>#include<iostream>
#include
<algorithm>
using namespace std;

int a[100005]={0};
int main()
{
    
int n,k,i;
    cin
>>n;
    
for(i=1; i<=n; i++)
      cin
>>a[i];
      
    sort(a
+1,a+1+n);
    
    getchar();getchar();getchar();getchar();
    
    cin
>>k; 
    
int temp;
    
for(i=1; i<=k; i++)
      { cin
>>temp;cout<<a[temp]<<endl; }
    
    system(
"pause");
    
return 0;
}


鐢板叺 2010-06-22 21:40 鍙戣〃璇勮
]]>
Ural 1025 Democracy in dangerhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/22/118492.html鐢板叺鐢板叺Tue, 22 Jun 2010 13:08:00 GMThttp://m.shnenglu.com/tianlearn-language/archive/2010/06/22/118492.htmlhttp://m.shnenglu.com/tianlearn-language/comments/118492.htmlhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/22/118492.html#Feedback0http://m.shnenglu.com/tianlearn-language/comments/commentRss/118492.htmlhttp://m.shnenglu.com/tianlearn-language/services/trackbacks/118492.html 

鏈塊緇勶紝鍙栦漢鏁拌緝?yōu)畯鐨?k+1)/2緇勫嵆鍙紝姣忕粍鍙?浜烘暟+1)/2錛屾帓涓嬪簭灝卞彲浠ヤ簡(jiǎn)
#include<iostream>
#include
<vector>
#include
<algorithm>
using namespace std;
int main()
{
    
int k,i,sum=0,temp;
    cin
>>k;   
    vector
<int>vec;
    
for(i=0; i<k; i++)
       { cin
>>temp;vec.push_back(temp); }
       
    sort(vec.begin(),vec.end());
    
for(i=0; i<=k/2; i++)
      sum
+=(vec[i]+1)/2;
      
    cout
<<sum<<endl;  
      
    system(
"pause");
    
return 0;
}


鐢板叺 2010-06-22 21:08 鍙戣〃璇勮
]]>
Ural 1022 Genealogical treehttp://m.shnenglu.com/tianlearn-language/archive/2010/06/22/118490.html鐢板叺鐢板叺Tue, 22 Jun 2010 12:37:00 GMThttp://m.shnenglu.com/tianlearn-language/archive/2010/06/22/118490.htmlhttp://m.shnenglu.com/tianlearn-language/comments/118490.htmlhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/22/118490.html#Feedback0http://m.shnenglu.com/tianlearn-language/comments/commentRss/118490.htmlhttp://m.shnenglu.com/tianlearn-language/services/trackbacks/118490.html
//Ural 1022
#include<iostream>
#include<vector>
using namespace std;
int a[101][101]={0};
vector<int>vec;
 int n,i,j;
bool f[101]={0};
void input()
{
    cin>>n;
    for(i=1; i<=n; i++)
    {
             j=1;
             while(cin>>a[i][j],a[i][j]!=0)
                      j++;
    }
}

void dfs(int i)
{
     if(f[i])return ;
     
     for(int j=1; a[i][j]!=0; j++)
        dfs(a[i][j]);
     f[i]=1; vec.push_back(i);
}

void topo()
{
     for(int i=1; i<=n; i++)
       if(!f[i])dfs(i);
     cout<<vec[vec.size()-1];
     for(int i=vec.size()-2; i>=0; i--)
         cout<<' '<<vec[i];
     cout<<endl;
}

int main()
{
   input();
   topo();
    
   system("pause");
   return 0;
}


鐢板叺 2010-06-22 20:37 鍙戣〃璇勮
]]>
Ural 1020 Ropehttp://m.shnenglu.com/tianlearn-language/archive/2010/06/22/118476.html鐢板叺鐢板叺Tue, 22 Jun 2010 09:05:00 GMThttp://m.shnenglu.com/tianlearn-language/archive/2010/06/22/118476.htmlhttp://m.shnenglu.com/tianlearn-language/comments/118476.htmlhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/22/118476.html#Feedback0http://m.shnenglu.com/tianlearn-language/comments/commentRss/118476.htmlhttp://m.shnenglu.com/tianlearn-language/services/trackbacks/118476.html

1020. Rope

Time Limit: 1.0 second
Memory Limit: 16 MB
Plotters have barbarously hammered N nails into an innocent plane shape, so that one can see now only heads. Moreover, pursuing their mean object, they have hammered all the nails into the vertices of a convex polygon. After that they…it is awful… have roped off the nails, so that the shape felt upset (the rope was very thin). They’ve done it as it is shown in the figure.
Problem illustration
Your task is to find out a length of the rope.

Input

There two numbers in the first line of the standard input: N 鈥?a number of nails (1 ≤ N ≤ 100), and a real number R 鈥?a radius of heads of nails. All the heads have the same radius. Further there are N lines, each of them contains a pair of real coordinates (separated by a space) of centers of nails. An absolute value of the coordinates doesn’t exceed 100. The nails are described either in a clockwise or in a counterclockwise order starting from an arbitrary nail. Heads of different nails don’t adjoin.

Output

Output a real number with two digits precision (after a decimal point) 鈥?a length of the rope.

Sample

input output
4 1
                        0.0 0.0
                        2.0 0.0
                        2.0 2.0
                        0.0 2.0
                        
14.28
                        
Problem Author: Alexander Petrov & Nikita Shamgunov
Problem Source: Ural State University Internal Contest October'2000 Junior Session

緇撴灉灝辨槸鍚勭嚎孌甸暱搴︾殑鍜屽姞涓婂崐寰勪負(fù)R鐨勫懆闀匡紝n=1鏃?闇棰濆鑰冭檻涓?br>
#include<iostream>
#include
<stdio.h>
#include
<cmath>
using namespace std;
double const  pi=acos(-1.0);
int main()
{
    
int n=0,i=0;
    
double sum=0,r=0,x0,y0,x1,y1,x,y;
    
    cin
>>n>>r;
    cin
>>x>>y;// 淇濆瓨絎竴涓偣  
    
    x0
=x1=x; y0=y1=y;
    sum
=2*pi*r;
    
for(i=1; i<n; i++)
    {
             cin
>>x1>>y1;
             sum
+=sqrt( (x1-x0)*(x1-x0)+ (y1-y0)*(y1-y0) );
             x0
=x1; y0=y1;
    }
    
if(n!=1) sum+=sqrt( (x1-x)*(x1-x)+ (y1-y)*(y1-y) );
    
    printf(
"%.2lf\n",sum);
    system(
"pause");
    
return 0;
}


鐢板叺 2010-06-22 17:05 鍙戣〃璇勮
]]>
Ural 1017 The Staircaseshttp://m.shnenglu.com/tianlearn-language/archive/2010/06/20/118320.html鐢板叺鐢板叺Sun, 20 Jun 2010 13:43:00 GMThttp://m.shnenglu.com/tianlearn-language/archive/2010/06/20/118320.htmlhttp://m.shnenglu.com/tianlearn-language/comments/118320.htmlhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/20/118320.html#Feedback0http://m.shnenglu.com/tianlearn-language/comments/commentRss/118320.htmlhttp://m.shnenglu.com/tianlearn-language/services/trackbacks/118320.htmlDP  鐘舵佽漿縐繪柟紼嬶細(xì)f[i][j]=f[i-1][j]+f[i-1][j-i]
//
Ural 1017
#include<iostream>
using namespace std;
const int MAX=505;
long long f[MAX][MAX]={0}; 
 
//f[i][j]琛ㄧず鏈鍚庝竴涓樁姊殑楂樺害涓嶈秴榪噄錛屼嬌鐢╦涓猙ricks鐨勬柟妗?nbsp; f[i][j]=f[i-1][j]+f[i-1][j-i] 
int main()
{
    
int n,i,j;
    cin
>>n;
    f[
0][0]=1;
    
for(i=1; i<=n; i++)
    {
    
for(j=n; j>=i; j--)
             f[i][j]
=f[i-1][j]+f[i-1][j-i];
    
for(j=0; j<=i-1; j++)
             f[i][j]
=f[i-1][j];
    }
    cout
<<f[n][n]-1<<endl;
    
    
//system("pause");
}



鐢板叺 2010-06-20 21:43 鍙戣〃璇勮
]]>
Ural 1014 The Product of Digitshttp://m.shnenglu.com/tianlearn-language/archive/2010/06/14/117871.html鐢板叺鐢板叺Mon, 14 Jun 2010 06:25:00 GMThttp://m.shnenglu.com/tianlearn-language/archive/2010/06/14/117871.htmlhttp://m.shnenglu.com/tianlearn-language/comments/117871.htmlhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/14/117871.html#Feedback0http://m.shnenglu.com/tianlearn-language/comments/commentRss/117871.htmlhttp://m.shnenglu.com/tianlearn-language/services/trackbacks/117871.html
#include<iostream>
using namespace std;
int a[10]={0};
int main()
{
    
int n,i;
    cin
>>n;
    
if(n==0){cout<<10<<endl;return 0;}
    
else if(n==1){cout<<1<<endl; return 0;}
    
int p=n;
    
for(i=9; i>=2; )
    {
        
if(p%i==0){a[i]++; p/=i;}
        
else i--;
    }
    
if(p!=1){ cout<<-1<<endl; return 0; }
    
for(i=2; i<=9; i++)
    
for(int j=1; j<=a[i]; j++)
      cout
<<i;
    cout
<<endl;
    
    system(
"pause");
    
return 0;
}


鐢板叺 2010-06-14 14:25 鍙戣〃璇勮
]]>
Ural 1021 Sacrament of the sumhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/14/117862.html鐢板叺鐢板叺Mon, 14 Jun 2010 04:11:00 GMThttp://m.shnenglu.com/tianlearn-language/archive/2010/06/14/117862.htmlhttp://m.shnenglu.com/tianlearn-language/comments/117862.htmlhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/14/117862.html#Feedback0http://m.shnenglu.com/tianlearn-language/comments/commentRss/117862.htmlhttp://m.shnenglu.com/tianlearn-language/services/trackbacks/117862.html
Accepted
0.062   1 241 KB

#include<iostream>
using namespace std;
int p1[100000]={0},p2[100000]={0};
int ne1[100000]={0},ne2[100000]={0};
int main()
{
    
int n1,n2,i,t;
    cin
>>n1;
    
for(i=0; i<n1; i++)
    {
     cin
>>t;
     
if(t>=0)p1[t]=1;
     
else ne1[-t]=1;
    }
    cin
>>n2;
    
for(i=0; i<n2; i++)
    {
        cin
>>t;
        
if(t>=0)p2[t]=1;
        
else ne2[-t]=1;  
    }
    
bool flag=0;
    
for(i=0; i<=100000; i++)
    {
      
if(p1[i])
          
if(i<=10000)
             { 
if(p2[10000-i]){flag=1;break;}}
          
else if(ne2[i-10000]){flag=1;break; }
    }
    
if(flag==0)
      
for(i=0; i<=100000; i++)
      {
      
if(p2[i])
          
if(i<=10000)
              { 
if(p1[10000-i]){flag=1;break;} }
          
else if(ne1[i-10000]){flag=1;break; }
      } 
      
if(flag)cout<<"YES"<<endl;
      
else cout<<"NO"<<endl;
    
   
// system("pause");
    return 0;
}


鐢板叺 2010-06-14 12:11 鍙戣〃璇勮
]]>
Ural 1001 Reverse roothttp://m.shnenglu.com/tianlearn-language/archive/2010/06/13/117815.html鐢板叺鐢板叺Sun, 13 Jun 2010 12:22:00 GMThttp://m.shnenglu.com/tianlearn-language/archive/2010/06/13/117815.htmlhttp://m.shnenglu.com/tianlearn-language/comments/117815.htmlhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/13/117815.html#Feedback0http://m.shnenglu.com/tianlearn-language/comments/commentRss/117815.htmlhttp://m.shnenglu.com/tianlearn-language/services/trackbacks/117815.html//鍙槸寮鏂?br>//
Accepted
0.25 1 237 KB

#include
<iostream>
#include
<cmath>
using namespace std;
double a[300000];
int main()
{
    
long long i,j=0;
    
while(cin>>i)
    {
       a[j
++]=sqrt(double(i));   
    }
    
for(i=j-1;i>=0; i-- )
     printf(
"%.4lf\n",a[i]);
     
    system(
"pause");
    
return 0;
}


鐢板叺 2010-06-13 20:22 鍙戣〃璇勮
]]>
Ural 1052 Rabbit hunthttp://m.shnenglu.com/tianlearn-language/archive/2010/06/13/117813.html鐢板叺鐢板叺Sun, 13 Jun 2010 12:10:00 GMThttp://m.shnenglu.com/tianlearn-language/archive/2010/06/13/117813.htmlhttp://m.shnenglu.com/tianlearn-language/comments/117813.htmlhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/13/117813.html#Feedback0http://m.shnenglu.com/tianlearn-language/comments/commentRss/117813.htmlhttp://m.shnenglu.com/tianlearn-language/services/trackbacks/117813.html//鍙栦袱鐐圭‘瀹氫竴鏉$洿綰匡紝璁$畻鍦ㄤ笂闈㈢殑鐐癸紝綰綍鏈澶х偣鏁?br>//
Accepted
0.031 201 KB

#include
<iostream>
#include
<cmath>
using namespace std;
int x[200],y[200];
double ex=1e-12;
int main()
{
    
int n,i,cnt,max=0,j;
    cin
>>n;
    
for(i=0;i<n; i++)
      cin
>>x[i]>>y[i];
    
    
for(i=0; i<n; i++)
    
for(j=i+1; j<n; j++)
    {
    cnt
=2;
      
int a=y[j]-y[i],
          b
=-(x[j]-x[i]),
          c
=-(y[j]-y[i])*x[i] + y[i]*(x[j]-x[i]);
      
for(int k=0; k<n; k++)
        
if(k==j||k==i)continue;
        
else if(a*x[k]+b*y[k]+c==0)cnt++;
      
if(cnt>max)max=cnt;
    }
    cout
<<max<<endl;
    system(
"pause");
    
return 0;
}


鐢板叺 2010-06-13 20:10 鍙戣〃璇勮
]]>
Ural 1086 Cryptographyhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/13/117810.html鐢板叺鐢板叺Sun, 13 Jun 2010 11:46:00 GMThttp://m.shnenglu.com/tianlearn-language/archive/2010/06/13/117810.htmlhttp://m.shnenglu.com/tianlearn-language/comments/117810.htmlhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/13/117810.html#Feedback0http://m.shnenglu.com/tianlearn-language/comments/commentRss/117810.htmlhttp://m.shnenglu.com/tianlearn-language/services/trackbacks/117810.html//棰樼洰瑕佹眰絎琄涓礌鏁幫紱k<=15000錛涙妸鍓?5000涓礌鏁板瓨璧鋒潵鍗沖彲錛屾瘡嬈¤緭鍑篴[k] 
//Accepted
0.062 277 KB

1
 #include<iostream>
 2 #include<cmath>
 3 using namespace std;
 4 const int cnt=15000;
 5 int a[cnt+1]={0};
 6 bool isprime(int n)
 7 {
 8      if(n==2||n==3||n==5||n==7)return 1;
 9      if(n%2==0||n<2)return 0;
10      double t=sqrt(n*1.0);
11      for(int i=3; i<=t; i+=2)
12        if(n%i==0)return 0;
13      return 1;
14 }
15 
16 int main()
17 {
18     int n,i,k,count=0;
19     cin>>n;
20     for(i=2; count<=cnt; i++)
21     {
22       if(isprime(i))a[++count]=i;
23     }
24     for(i=1; i<=n; i++)
25       { cin>>k; cout<<a[k]<<endl;}
26     system("pause");
27     return 0;
28 }
29 

鐢板叺 2010-06-13 19:46 鍙戣〃璇勮
]]>
Ural 1084 Goat in the Gardenhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/13/117808.html鐢板叺鐢板叺Sun, 13 Jun 2010 11:32:00 GMThttp://m.shnenglu.com/tianlearn-language/archive/2010/06/13/117808.htmlhttp://m.shnenglu.com/tianlearn-language/comments/117808.htmlhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/13/117808.html#Feedback0http://m.shnenglu.com/tianlearn-language/comments/commentRss/117808.htmlhttp://m.shnenglu.com/tianlearn-language/services/trackbacks/117808.html//綆鍗曟暟瀛﹂ 
/*
Accepted
0.031 233 KB
*/
#include
<iostream>
#include
<cmath>
using namespace std;
int main()
{
    
double p2=sqrt(2.0),
           pi
=acos(-1.0),
           tri,
//瑙掑害 
           area=0;
    
int l,r;
    cout.precision(
3);
    cin
>>l>>r;
    
if(r<l*1.0/2)cout<<fixed<<pi*r*r<<endl;
    
else if(r>l*1.0*p2/2)cout<<fixed<<(double)l*l<<endl;
    
else {
         tri
=acos(l*1.0/(2*r));
         area
+=(l*1.0*r*sin(tri)/2);
         area
+=(pi/2-2*tri)*r*r/2;
         area
*=4;
         cout
<<fixed<<area<<endl;
    }
    system(
"pause");
    
return  0;
}


鐢板叺 2010-06-13 19:32 鍙戣〃璇勮
]]>
Ural 1005 Stone pilehttp://m.shnenglu.com/tianlearn-language/archive/2010/06/13/117799.html鐢板叺鐢板叺Sun, 13 Jun 2010 08:32:00 GMThttp://m.shnenglu.com/tianlearn-language/archive/2010/06/13/117799.htmlhttp://m.shnenglu.com/tianlearn-language/comments/117799.htmlhttp://m.shnenglu.com/tianlearn-language/archive/2010/06/13/117799.html#Feedback0http://m.shnenglu.com/tianlearn-language/comments/commentRss/117799.htmlhttp://m.shnenglu.com/tianlearn-language/services/trackbacks/117799.html//鎼滅儲(chǔ)錛孫(2^n)
#include
<iostream>
//#include<limit.h>
#include<cmath>
using namespace std;
int w[21]={0};
int n,total=0,ans=INT_MAX;
void search(int i,int now)
{
    
if(i>n)
    {
       
if(ans>abs(total-2*now))ans=abs(total-2*now);
       
return ;
    }
    search(i
+1,now+w[i]);
    search(i
+1,now);
}

int main()
{
    
    cin
>>n;
    
for(int i=1;i<=n; i++)
     {  cin
>>w[i];total+=w[i];}
    
    search(
1,0);
    cout
<<ans<<endl;
    
    
return 0;
}

DP錛?1鑳屽寘 寰瀹歸噺涓簍otal/2鐨勫寘閲岃鐭沖ご錛屼環(huán)鍊間笌閲嶉噺鐩哥瓑
//
Accepted
0.031     3933 KB

#include
<iostream>
using namespace std;
const int SIZE=21;
int w[SIZE]={0};
int dp[SIZE*100000/2+5]={0};
int main()
{
    
int n,i,total,v,j;
    cin
>>n;
    
for(i=1,total=0; i<=n ; i++ )
        { cin
>>w[i]; total+=w[i]; }
        
    v
=total/2;
  
    
for(i=1; i<=n; i++)
    
for(j=v; j>=w[i]; j-- )
      
if(dp[j]<dp[j-w[i]]+w[i])
        dp[j]
=dp[j-w[i]]+w[i];
    
    cout
<<total-2*dp[v]<<endl;
    
return 0;
}


鐢板叺 2010-06-13 16:32 鍙戣〃璇勮
]]>
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
      <noscript id="pjuwb"></noscript>
            <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
              <dd id="pjuwb"></dd>
              <abbr id="pjuwb"></abbr>
              亚洲欧洲日韩综合二区| 亚洲国产天堂久久综合网| 亚洲欧美在线网| 亚洲一区二区高清视频| 亚洲精品老司机| 日韩午夜视频在线观看| 亚洲精品欧美| 国产精品成人一区二区艾草| 欧美日韩国产限制| 国产精品―色哟哟| 激情婷婷亚洲| 99精品国产99久久久久久福利| 亚洲一区美女视频在线观看免费| 午夜精品一区二区三区在线| 久久躁日日躁aaaaxxxx| 亚洲人体影院| 久久在线视频在线| 国产精品综合久久久| 亚洲日本电影| 免费成人高清视频| 欧美在线免费播放| 国产精品色一区二区三区| 99亚洲视频| 免费精品视频| 亚洲欧美日韩国产精品| 欧美精品www在线观看| 伊人久久婷婷色综合98网| 午夜久久久久久久久久一区二区| 欧美r片在线| 欧美在线欧美在线| 国产伦精品一区二区三区视频黑人 | 亚洲全部视频| 蜜臀a∨国产成人精品| 午夜精品成人在线| 国产欧美精品在线观看| 99亚洲精品| 中文日韩在线| 国产精品视频最多的网站| 亚洲欧美日韩精品一区二区| 伊人男人综合视频网| 久久免费视频观看| 欧美1级日本1级| 亚洲免费电影在线| 日韩视频一区二区三区| 欧美午夜在线一二页| 欧美在线影院| 久久精品国产亚洲高清剧情介绍| 国产综合欧美| 亚洲国产精品ⅴa在线观看| 欧美久久一区| 久久久久久国产精品mv| 欧美日韩亚洲高清一区二区| 午夜精品亚洲| 欧美日韩国产成人高清视频| 性欧美大战久久久久久久久| 久久久综合精品| 性高湖久久久久久久久| 久久久久久精| 久久久久国产一区二区| 欧美日韩一区二区精品| 欧美韩国日本一区| 欧美日韩免费视频| 亚洲二区免费| 黑人操亚洲美女惩罚| 一区二区欧美日韩视频| 亚洲激情综合| 久久精品一级爱片| 午夜精品亚洲| 国产欧美另类| 欧美一级黄色网| 久久黄色网页| 激情视频一区二区| 久久久久国产成人精品亚洲午夜| 在线综合欧美| 欧美日韩久久| 亚洲视频欧美视频| 欧美日韩精品一区二区三区四区 | 欧美日韩和欧美的一区二区| 欧美成熟视频| 日韩亚洲欧美成人一区| 欧美激情一二区| 一区二区电影免费观看| 欧美亚洲在线播放| 禁断一区二区三区在线| 免费不卡在线观看| 亚洲天堂网站在线观看视频| 久久精品视频在线看| 亚洲国产视频直播| 免费成人高清| 亚洲男女自偷自拍| 欧美电影免费观看高清| 日韩视频在线一区二区| 国产精品欧美久久久久无广告| 久久精品综合网| 亚洲一区影音先锋| 欧美大片专区| 久久久久亚洲综合| 亚洲欧美日韩国产综合| 亚洲精品视频在线| 欧美激情1区2区3区| 亚洲欧美一区二区激情| 亚洲大胆人体视频| 国产亚洲福利社区一区| 国产精品高清在线| 欧美日产国产成人免费图片| 久久在线免费观看视频| 先锋亚洲精品| 欧美一区二区日韩| 新67194成人永久网站| 亚洲精品国产精品乱码不99| 欧美第十八页| 亚洲第一区中文99精品| 久久久久久久综合日本| 国产精品日韩高清| 欧美午夜不卡在线观看免费| 欧美日韩在线播放三区| 欧美精品成人| 国产伦一区二区三区色一情| 欧美三级在线| 国内精品免费午夜毛片| 国产日韩在线一区| 国产综合av| 亚洲精品资源| 亚洲一区二区三区久久 | 欧美中文在线免费| 猫咪成人在线观看| 亚洲黄色在线视频| 亚洲摸下面视频| 欧美成人在线免费观看| 国产精品成人国产乱一区| 在线观看精品一区| 亚洲综合色激情五月| 你懂的视频欧美| 午夜精品久久久久99热蜜桃导演| 久久国产精品久久国产精品| 欧美精品色网| 激情综合色综合久久| 亚洲无线一线二线三线区别av| 久久精品国内一区二区三区| 99国产精品99久久久久久粉嫩| 久久黄色影院| 国外成人在线| 久久嫩草精品久久久久| 亚洲在线观看| 国产精品久久久免费| av72成人在线| 亚洲免费激情| 国产精品乱码久久久久久| 亚洲美女在线观看| 久久免费少妇高潮久久精品99| 午夜在线播放视频欧美| 国产欧美精品日韩| 欧美一区二区三区免费视频| 亚洲国产免费看| 欧美激情1区2区| 欧美激情偷拍| 亚洲与欧洲av电影| 亚洲欧美日韩国产一区| 国产日韩欧美一区在线| 久久久另类综合| 美女精品国产| 亚洲尤物影院| 久久手机免费观看| 亚洲毛片av在线| 亚洲欧美激情诱惑| 狠狠色丁香婷婷综合久久片| 欧美大片免费观看在线观看网站推荐| 欧美成人伊人久久综合网| 亚洲综合成人在线| 欧美在线视频二区| 日韩视频免费在线| 亚洲欧美精品在线观看| 在线看视频不卡| 国产精品99久久99久久久二8| 国产一区二区高清| 亚洲精品在线免费观看视频| 精品96久久久久久中文字幕无| 亚洲国产欧美在线人成| 国产九九精品| 亚洲美女在线视频| 亚洲人妖在线| 美日韩精品视频| 久久久国产精品一区| 国产伦一区二区三区色一情| 91久久精品日日躁夜夜躁国产| 亚洲国产91色在线| 久久五月婷婷丁香社区| 久久综合色天天久久综合图片| 欧美午夜视频在线观看| 亚洲免费av网站| 国产日韩精品视频一区| 亚洲一区二区三区精品动漫| 亚洲午夜视频在线观看| 国产精品羞羞答答xxdd| 亚洲在线播放| 亚洲国产成人tv| 亚洲一区观看| 黄色亚洲免费| 你懂的视频一区二区| 亚洲美女黄色|