luminous electric

Read about luminous electric, The latest news, videos, and discussion topics about luminous electric from alibabacloud.com

Hangzhou electric oj1384--intervals (differential constraint)

[50005], CNT;voidADD (intAintBintC{Edge E = {A, B, C, head[a]};EDGE[CNT] = E;Head[a] = cnt++;}voidSPFA (){ for(inti = Min;I Dis[i] =-inf;Dis[min] =0; The longest road;queueint> Q;Q.push (Min); while(! Q.empty ()){intU = Q.front (); Q.pop ();Vis[u] =0; for(inti = Head[u]; I! =-1; i = edge[i].next){intv = edge[i].to;if(Dis[v] {DIS[V] = Dis[u] + edge[i].val;if(!vis[v]){VIS[V] =1;Q.push (v);}}}}printf"%d\n", Dis[max]);}intMain (){intN while(~SCANF ("%d", n)){Min = INF;Max =-inf; CNT =0;memset (Vis,0

Hangzhou Electric 1596 Find the safest road (minimum path deformation for maximum safety)

22 31 3Sample Output0.5000.4000.500The shortest path used before is the Min function initialization array map[][] is positive infinity, the problem of maximum security to initialize the array with the MAX function is negative infinity.1#include 2#include 3 #defineInf-0xfffffff4 using namespacestd;5 intN;6 Doublemap[1005][1005];7 voidF1 ()8 {9 intk,i,j;Ten for(k =1; K ) One { A for(i =1; I ) - { - for(j =1; J ) the { -Map[i][j]=max (Map[i][j

Hangzhou Electric 1466 Calculate the line of intersection

intersections: 3 Parallel lines and 1 free line intersection number + 1 free line can form the number of intersections, that is 3+0=33, when i=2,n-i=2, the number of intersections: 2*2+{0,1}={4,5}4, when i=1,n-i=3, the number of intersections: 1*3+{0,2,3}={3,5,6}each free line has an intersection with each parallel line, and the number of intersections of the J free and I parallel lines is j*i, so the intersection of the n lines equals the intersections of the free and parallel lines plus the i

Hangzhou Electric 2096

Xiao Ming A+bTime limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)Total submission (s): 37194 Accepted Submission (s): 17644Problem Description Ming is 3 years old, now he has been able to recognize 100 of non-negative integers, and be able to do a non-negative integer within 100 of the addition calculation.for integers greater than or equal to 100, xiaoming only retains the last two digits of the number for calculation, and if the result is greater than or equal to 100,

The shortest path problem of HDU 3790 in Hangzhou Electric power ACM

[I][J]=INF; }}voidDijkstraintv0) { BOOLVIS[MX]; for(intI=1; i) {Dis[i]=Map[v0][i]; Pre[i]=Price[v0][i]; Vis[i]=false; } Dis[v0]=0; Vis[v0]=true; for(intI=1; i){ inttmp=inf,p=Inf,u; for(intj=1; j) if(!vis[j]dis[j]tmp) {u=J; TMP=Dis[j]; } Vis[u]=true; for(intj=1; j) if(!Vis[j]) { if(dis[u]+map[u][j]Dis[j]) {Dis[j]=dis[u]+Map[u][j]; PRE[J]=pre[u]+Price[u][j]; }Else if(dis[u]+map[u][j]==dis[j]pre[u]+price[u][j]Pre[j]) pre[j]=pre[u]+Price[u][j]; }

Hangzhou Electric 1176 Free pie

multiple sets of input data. The first behavior of each group of data is a positive integer n (0OutputEach set of input data corresponds to one row of output. Output an integer m, indicating that Gameboy may receive a maximum of M pies.Tip: The amount of input data in the subject is relatively large, it is recommended to read in scanf, with CIN may time out.Sample Input65 14 16 17 27 28 30Sample Output4A number of tower models, from the bottom up, to add a coordinate, to find d[0][6], the array

HDU 5734 acperience (Formula derivation) 2016 Hangzhou Electric Multi-school joint second field

Title: Portal.#include #include#include#includeusing namespacestd;intgcdLong LongALong Longb) { if(!B)returnA; returnGCD (b,a%b);}inta[100005];intMain () {intT,n; scanf ("%d",T); while(t--) { Long Longsum=0; scanf ("%d",N); for(intI=0; i) {scanf ("%d",A[i]); if(a[i]0) A[i] =-A[i]; Sum+=A[i]; } Long LongAP = Sum,aq =N; Long Longg =gcd (n,sum); AP= ap/G; AQ= aq/G; //printf ("%i64d/%i64d\n", Ap,aq); Long Longz=0; Long Longm=0; for(intI=0; i) {Z+=a[i]*A[i]; M+=2*A[i]; }

HDU 5752 Sqrt Bo (thinking problem) 2016 Hangzhou Electric Multi-school joint third Field

Title: Portal.Test instructions: A large number of N, up to 5 times the root of the root, ask several square root can get 1, if 5 times can not get 1 on the output tat.Problem solving:x1=1,x2= (x1+1) * (x1+1)-1, etc. X5 is not more than a long long , the output can be judged.#include #include#include#includeusing namespaceStd;typedefLong Longll;Charc[1005];intMain () { while(cin>>c) {intlen=strlen (c); if(len>= the) {printf ("tat\n"); } Else{ll n=c[0]-'0'; LL Maxx=4294967295; for(intI=1;

Hangzhou Electric 2024

1#include 2 Chars[Wuyi];3 intLenth (Chars[])4 {5 intI=0;6 while(S[i])7++i;8 returni;9 }Ten intMain () One { A intI,n; - while(~SCANF ("%d",N)) - { the GetChar (); - while(n--) - { - gets (s); + intlen=Lenth (s); - for(i=0; ii) + { A if(i) at { - if(! (s[i]=='_'|| (s[i]>='a's[i]'Z')|| (s[i]>='A's[i]'Z')|| (s[i]>='0's[i]'9'))) - Break; -

Hangzhou Electric 1878 Euro-pull circuit

; - } thescanf"%d",m); * for(i =0; I ) $ {Panax Notoginsengscanf"%d%d",a,b); -d[a]++; thed[b]++;//record the degree of each point + F1 (A, b); A } theCnt=0; key=0; + for(i =1; i) - { $ if(D[i]%2)//To judge that each point is an even degree $ { -key=1; - } the if(i = = Fa[i])//Judging there's no independent point - {Wuyicnt++; the } - } Wu if(CNT = =1)//There

Hangzhou Electric 2012

1#include 2#include 3 intMain ()4 {5 intn,m,i,j,t,x,y;6 while(~SCANF ("%d%d", x,y) (x| |y))7 {8 for(i=x,t=1; ii)9 {Tenx=i*i+i+ A; OneN= (int) sqrt (Double) x); A for(j=2; jj) - { - if(! (%j)) the Break; - } - if(jN) -t=0; + } - if(t) +printf"ok\n"); A Else atprintf"sorry\n"); - } - return 0; -}Hangzhou Electric

Hangzhou Electric ACM 1181 Transformation Course DFS

)Sample Inputsosoonrivergoesthemgotmoonbeginbig0 Sample Outputyes. Harry can read this mantra: "Big-got-them."#include #include#include#includestring.h>using namespacestd;BOOLvis[ +];Charstr[ +][ +]; BOOLBFsintN) {Queueint>que; intA, Len; for(inti =0; I //first, the first letter is a b queue. { if(str[i][0] =='b') {Que.push (i); Vis[i]=true;//indicates that the word has been marked. } } while(!Que.empty ()) {a=Que.front (); Que.pop (); Len= strlen (Str[a])-1;//The

Hangzhou Electric 2016

1#include 2 intMain ()3 {4 inta[ -],n,i,t,k;5 while(~SCANF ("%d", n) N)6 {7 for(i=k=0; ii)8 {9scanf"%d",a[i]);Ten if(A[i]//looking for the minimum value position Onek=i; A } - if(k)//not the first one, then the first exchange. - { thet=a[0]; -a[0]=A[k]; -a[k]=T; - } + for(i=0; ii) - if(i)//Control output Format +printf"%d", A[i]); A Else atprintf"%d", A[i]); -printf"\ n"); - } - ret

Hangzhou Electric 1106

); This is the prototype, which decomposes the string into a set of strings. The string that s wants to break down. D is a delimiter character because all D is substituted for the first execution of this function, so you need to change s to NULL when you call it again (the C language takes it as the last character of the string to represent the end of the string. ") ").Function Three:Atoi () (representing alphanumeric to integer) is a function that converts a string into an integer number. belon

Hangzhou Electric OJ 1004 realization and some traps of attention

The 1004 question is actually very simple, is wants you to count the most balloons the number, but in the output time but needs to be careful carefully, conforms to the question request.In the output is the first note is the output order: If there are multiple numbers of the same color, first input first output, such as,RedGreenRedGreenThis situation requires an outputRedGreenPost the AC code:#include   Hangzhou Electric OJ 1004 realization and some t

HDU 5705 Clock (2016 Hangzhou Electric Girls Session 1004)--angle chase and problem

problem of precision.See the code for details:1#include 2 intMain ()3 {4 inth,m,s,a,da,tots= A*3600* One, kase=1;5 while(SCANF ("%d:%d:%d", h,m,s) = =3)6 {7 intTar = One* (h*3600+m* -+s);8scanf"%d",a);9Da = the-2*A;Ten intCNT = A * -, F =1; One //The position at the beginning is a° (obviously the first minute is the second hand in front) . A while(cnttar) - { - if(f) the { -f=0; -cnt+=da* -;//The first Chase is the an

Hangzhou Electric 2803 The MAX (sort)

descriptiongiving N integers, V1, V2,,,, Vn, you should find the biggest value of F.Inputeach test case contains a single integer N (11#include 2#include 3 using namespacestd;4 inta[100000];5 intMain ()6 {7 __int64 n,j;8 while(SCANF ("%i64d", n) N)9 {Ten for(__int64 i=0; i) One { Ascanf"%d",a[i]); - } -Sort (a,a+n); thej=a[n-1]*( .-n); - for(__int64 i=1; i ) -j=j+a[n-1-i]; -printf"%i64d\n", j); + } -}Hangzhou El

Hangzhou Electric 5053 The Sum of the cube (for the cubic and in the interval) to play the table method

Descriptiona range is given, the begin and the end are both integers.You should sum the cube of all the integers in the range. Inputthe first line of the input was T (1 Each case of input is a pair of integer A, a (0 1#include 2__int64 a[1000000]={0,1};3 intMain ()4 {5 for(__int64 i=1; i1000000; i++)6 {7a[i]=a[i-1]+i*i*i;8 }9__int64 t,k=0;;Tenscanf"%i64d",t); One while(t--) A { - __int64 m,n; -scanf"%i64d%i64d",m,n); theprintf"Case #%i64d:%i64d\n", ++k,a[n]-a[m-1]); - }

ACM INTRODUCTION Hangzhou Electric 1001 questions about overflow considerations

) is multiplied, it overflows. The title asks "may assume the result is in the range of 32-bit signed integer", which requires that the sum is a 32-bit signed integer. The sum of the test data given by OJ (n (n+1)/2) must be within the range of 32-bit integers, but (n (n+1)) is not necessarily. The reason you can infer WA should be here. You can subtly change the formula:Putsum=n* (n+1)/2;Switchif (n%2==0)sum=n/2* (n+1);ElseSum= (n+1)/2*n;The entire code is as follows:1#include 2 intMain ()3 {4

Poj2117 Electricity (electric)

=getchar ())if(ch=='-') f=-1; for(; isdigit (ch); Ch=getchar ()) x=x*Ten+ch-'0'; returnx*F;} InlinevoidWriteintx) { if(x0) Putchar ('-'), x=-x; if(x>9) Write (x/Ten); Putchar (x%Ten+'0'); return ;}intn,m;inthead[100006];intnxt[200006],to[200006];intTotal=0;voidAddintXinty) { Total++; To[total]=y; Nxt[total]=Head[x]; HEAD[X]=Total ; return ;}intdfn[100006],low[100006];inttot=0;intnum[100006];voidTarjan (intXintFA) {Dfn[x]=low[x]=++tot; for(intE=head[x];e;e=Nxt[e]) { if(!Dfn[to[e]])

Total Pages: 15 1 .... 11 12 13 14 15 Go to: Go

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.