歲月的童話
在乎當前這一秒,不要遺忘自己的幸運
首頁
新隨筆
聯系
聚合
管理
隨筆分類
2:30(2)
(rss)
intricate(1)
(rss)
初中風格的平面幾何(1)
(rss)
待續(3)
(rss)
二分(2)
(rss)
分類討論(1)
(rss)
復雜圖元簡化
(rss)
幾何
(rss)
精度(1)
(rss)
三維幾何(2)
(rss)
掃描線
(rss)
數學(2)
(rss)
隨機增量(1)
(rss)
索引(2)
(rss)
凸包
(rss)
圓(1)
(rss)
整點幾何
(rss)
字符串(1)
(rss)
文章分類
pku(13)
(rss)
sgu(4)
(rss)
隨筆檔案
2011年1月 (1)
2010年12月 (1)
2010年11月 (1)
2010年8月 (1)
2010年7月 (5)
2010年6月 (4)
2010年2月 (1)
2009年12月 (1)
2009年11月 (11)
文章檔案
2010年12月 (4)
2010年7月 (2)
2010年3月 (10)
2010年2月 (1)
相冊
09哈爾濱regional
09寧波regional
正裝
最新隨筆
1.?求兩個正規式之間的編輯距離
2.?開始閱讀 using OpenMP
3.?最后的區域賽
4.?精度小技巧
5.?旋轉
6.?單調性
7.?Stars 坐標旋轉
8.?Deformed Wheel 滾石頭
9.?Warehouse Location 最小包圍球
10.?pipes 插頭dp
最新評論
1.?re: 最后的區域賽
仰慕你的學弟:
后來不是進了 final 嗎,為什么不來更正一下呢?
--coreBugZJ
2.?re: The Return of Carl 正八面體上的最短路
同學你有這道題的源程序嗎??同學我急用啊~Q我,289185858,左手右手,謝啦~~~
--左手右手
3.?re: 最后的區域賽
呵呵,保送到ICT,我也是ICT的。。。以后就是同學啦,很厲害呀!有點可惜沒有進final。。。
--Sosi
4.?re: NWERC 2009
評論內容較長,點擊標題查看
--王之昊
5.?re: NWERC 2009
請問NWERC2009的標程和數據在能找到啊,acmicpc.org.cn上的solution屬于標程嗎
--aga
sgu 118
Posted on 2010-12-15 11:48
王之昊
閱讀(202)
評論(0)
編輯
收藏
引用
所屬分類:
sgu
對于“數根”(定義見
Let
f(n)
be a sum of digits for positive integer
n
. If
f(n)
is one-digit number then it is a digital root for
n
and otherwise digital root of n is equal to digital root of
f(n)
.
)注意這里只定義正整數的“數根”,所以已經把 0 排除了。
結論: 數根f(n)與n模9同余,且f(n)的范圍屬于[1,9].
證明:如果n = a
m
*10
m
+ a
m-1
*10
m-1
+...+ a
0
*10
0
, 令g(n) = a
m
+a
m-1
+...+a
0
.
n
->
[n
0
=g(n)]
->
[
n
1
=g(n
0
)]
->
[n
2
=g(n
1
)]
->
...
->
f(n)
中間的每個環節都是模9同余的,傳遞下去,所以n和f(n)也是模9同余的
1
2
import
java.io.FileNotFoundException;
3
import
java.util.Scanner;
4
5
6
/**/
/*
7
* To change this template, choose Tools | Templates
8
* and open the template in the editor.
9
*/
10
/** */
/**
11
*
12
*
@author
wangzhihao
13
*/
14
class
Seq
{
15
16
int
[] A;
17
18
Seq(
int
[] a)
{
19
A
=
a;
20
}
21
int
DigitSum()
{
22
int
res
=
0
, term
=
1
;
23
for
(
int
i
=
0
; i
<
A.length; i
++
)
{
24
term
=
term
*
( A[i]
%
9
)
%
9
;
25
res
=
( res
+
term )
%
9
;
26
}
27
return
res
==
0
?
9
: res;
28
}
29
}
30
31
public
class
Solution
{
32
33
/** */
/**
34
*
@param
args the command line arguments
35
*/
36
public
static
void
main(String[] args)
throws
FileNotFoundException
{
37
Scanner sc
=
new
Scanner(System.in);
38
int
testCase
=
sc.nextInt();
39
for
(
int
cas
=
1
; cas
<=
testCase; cas
++
)
{
40
int
n
=
sc.nextInt();
41
int
[] a
=
new
int
[n];
42
for
(
int
i
=
0
; i
<
n; i
++
)
{
43
a[i]
=
sc.nextInt();
44
}
45
Seq seq
=
new
Seq(a);
46
System.out.println(seq.DigitSum());
47
}
48
}
49
}
50
只有注冊用戶
登錄
后才能發表評論。
【推薦】100%開源!大型工業跨平臺軟件C++源碼提供,建模,組態!
相關文章:
sgu 118
sgu 222
sgu 221
sgu 502
網站導航:
博客園
IT新聞
BlogJava
博問
Chat2DB
管理
常用鏈接
我的隨筆
我的評論
我參與的隨筆
acmer
aekdycoin
幾何帝 Isun
ict
小樂
隊友
陳乾
羅位超
好的中文網站
matrix67
南方科技大學
我愛自然語言處理
我參與的團隊
評論排行榜
1.?NWERC 2009(2)
2.?fzu 1775 Counting Binary Trees (2)
3.?最后的區域賽(2)
4.?The Return of Carl 正八面體上的最短路(1)
5.?Conduit Packing 包圍四個圓的最小園(0)
閱讀排行榜
1.?NWERC 2009(1126)
2.?Warehouse Location 最小包圍球(1037)
3.?ACM計算幾何題目推薦(轉自PKKJ @ SCAU )(781)
4.?計算幾何索引 (轉) (607)
5.?建立鄰接表(599)
posts - 26, comments - 7, trackbacks - 0, articles - 17
Copyright © 王之昊
久久久久亚洲精品天堂
|
青青青国产成人久久111网站
|
国产激情久久久久影院老熟女
|
九九精品99久久久香蕉
|
99久久精品国内
|
久久久精品久久久久久
|
人妻无码精品久久亚瑟影视
|
久久人人爽人人爽人人片AV不
|
91精品国产91久久久久福利
|
91精品无码久久久久久五月天
|
香蕉aa三级久久毛片
|
漂亮人妻被黑人久久精品
|
伊人久久大香线蕉精品
|
精品久久久久久久久免费影院
|
国产精品国色综合久久
|
久久亚洲国产精品123区
|
精品久久久无码人妻中文字幕豆芽
|
国产AⅤ精品一区二区三区久久
|
波多野结衣久久
|
成人亚洲欧美久久久久
|
久久精品人人做人人爽97
|
久久亚洲中文字幕精品有坂深雪
|
伊人色综合久久天天
|
色妞色综合久久夜夜
|
色妞色综合久久夜夜
|
久久99国产一区二区三区
|
久久久久久精品无码人妻
|
久久人妻少妇嫩草AV无码蜜桃
|
久久亚洲国产成人精品性色
|
一本色道久久88综合日韩精品
|
久久综合中文字幕
|
久久久久亚洲AV成人片
|
亚洲国产精品无码久久
|
国产69精品久久久久观看软件
|
久久亚洲AV无码西西人体
|
久久精品www
|
国产精品亚洲美女久久久
|
99久久精品国产麻豆
|
久久国产亚洲精品麻豆
|
久久久青草青青亚洲国产免观
|
久久91精品国产91久久麻豆
|