Let'sdefinelogicalORasanoperationontwologicalvalues(i.e.valuesthatbelongtotheset{0, 1})thatisequalto1ifeitherorbothofthelogicalvaluesissetto1,otherwiseitis0.WecandefinelogicalORofthreeormorelogicalvaluesinthesamemanner:whereisequalto1ifsomeai = 1,otherwiseitisequalto0.NamhasamatrixAconsistingofmrowsandncolumns.Therowsarenumberedfrom1tom,columnsarenumberedfrom1ton.Elementatrowi(1 ≤ ...
Forapositiveintegernlet'sdefineafunctionf:f(n) = - 1 + 2 - 3 + .. + ( - 1)nnYourtaskistocalculatef(n)foragivenintegern.InputThesinglelinecontainsthepositiveintegern(1 ≤ n ≤ 1015).OutputPrintf(n)inasingleline.Sampletest(s)input[crayon-678744db3a651427118586/]output[crayon-678744db3a659997943515/]input[crayon-678744db3a65c496735854/]output[crayon-678744db3a65f586814765/]N...
近期评论