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-6842301ac609b431629552/]output[crayon-6842301ac60a3277626106/]input[crayon-6842301ac60a6377084258/]output[crayon-6842301ac60a9712232199/]N...
近期评论