noi 八進位制小數
1 #include <cmath> 2 #include <cstdio> 3 #include <cstring> 4 double n2=0; 5 char n1[20]; 6 int main() 7 { 8 scanf("%s",n1); 9 int nl=strlen(n1); 10 for(int i=2; i<nl; i++) 11 n2+=(n1[i]-'0')*1.0/pow(8,double(i-1)); 12 printf("%s [8] = %.50g [10]",n1,n2);13 return 0; 14 }
原題連結:http://www.noi.openjudge.cn/ch0113/03/
相關推薦
noi 八進位制小數
1 #include <cmath> 2 #include <cstdio> 3 #include <cstring> 4 double n2=0; 5 char n1[20]; 6 int main() 7 { 8 scanf("%s",n1
2765 :八進位制小數
總時間限制: 1000ms 記憶體限制: 65536kB 描述 八進位制小數可以用十進位制小數精確的表示。比如,八進位制裡面的0.75等於十進位制裡面的0.963125 (7/8 + 5/64)。所有小數點後位數為n的八進位制小數都可以表示成小數點後位數不多於3
POJ NOI0113-03 八進位制小數(Bailian2765)
總時間限制:1000ms記憶體限制: 65536kB描述 八進位制有限小數均可以用十進位制有限小數精確地表示。比如,八進位制裡面的0.75等於十進位制裡面的0.963125 (7/8 + 5/64)。所有小數點後位數為n的八進位制小數都可以表示成小數點後位數不多於3n
Python: 二進位制、八進位制、十六進位制轉換或者輸出
為了將整數轉換為二進位制、八進位制或十六進位制的文字串,可以分別使用bin() ,oct() 或hex() 函式: >>> x = 1234 >>> bin(x) '0b10011010010' >>> oct(x) '0o2322' >&g
十進位制轉八進位制 轉二進位制 java實現
程式碼 private static void myToOctalString(int a) { String str = ""; while (true) { str = a % 8 + str; a = a / 8; if (a == 0) bre
[計算機程式設計C++] 輸入整數顯示十六進位制和八進位制
12 輸入整數顯示十六進位制和八進位制(10分) 題目內容: 編寫程式,輸入整數,顯示其十進位制、十六進位制和八進位制形式。如輸入31,輸出: -31 -1f -37 輸入:一個整數,注意,可能是負數。 輸出:三個數,十進位制、十六進位制和八進位制,用空格隔開。 提示
xxx2xxx轉換工具邪惡八進位制收集整理上傳專用主題 不斷更新 https //forum eviloctal com/
分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!  
Python程式設計:二進位制,八進位制,十六進位制與十進位制之間的轉換
進位制轉換的函式 bin() 10進位制轉2進位制 oct() 10進位制轉8進位制 hex()10進位制轉16進位制 int() *進位制轉10進位制 各進位制之間轉換 ↓ 2進位制 8進位制
藍橋杯: 基礎練習 十六進位制轉八進位制
問題描述 給定n個十六進位制正整數,輸出它們對應的八進位制數。 輸入格式 輸入的第一行為一個正整數n (1<=n<=10)。 接下來n行,每行一個由0~9、大寫字母A~F組成的字串,表示要轉換的十六進位制正整數,每個十六進位制數長度不超過100000。 輸出格式 輸出n行,每行
藍橋杯十六進位制轉八進位制
問題描述 給定n個十六進位制正整數,輸出它們對應的八進位制數。輸入格式 輸入的第一行為一個正整數n (1<=n<=10)。 接下來n行,每行一個由0~9、大寫字母A~F組成的字串,表示要轉換的十六進位制正整數,每個十六進位制數長度不超過100000。輸出格式 輸出n行,每行為輸入對應的八進
八進位制轉義字元與十六進位制轉義字元
一般形式 在C中有兩種特殊的字元,八進位制轉義字元和十六進位制轉義字元,八進位制字元的一般形式是'\ddd',d是0-9的數字。十六進位制字元的一般形式是'\xhh',h是0-9或A-F內的一個。八進位制字元和十六進位制字元表示的是字元的ASCII碼對應的數值。比如 '\063'表示的是字元
JAVA 二進位制,八進位制,十六進位制,十進位制間進行相互轉換
分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!  
python : 二進位制、八進位制,十進位制和十六進位制的相互轉換
二進位制、八進位制和十六進位制轉化為十進位制: 二進位制轉化為十進位制:print(int("111",2)) 輸出為7 八進位制轉化為十進位制:print(int("11",8)) 輸出為9 十六進位制轉化為十
C++入門篇——輸入一個整數並將這個整數分別以八進位制,十進位制,十六進位制輸出;同時輸入一個布林值並且以布林值的方式打印出來
C++入門篇 輸入一個整數並將這個整數分別以 八進位制,十進位制,十六進位制輸出; 同時輸入一個布林值並且以 布林值的方式打印出來 注意:執行的時候需要按 ctrl鍵+F5 如果想只按F5就執行,在return 0;前面加一段程式碼: system("pause"); 同時需要
Problem B: 將十進位制數對應的八進位制、十六進位制、十進位制數輸出
Problem B: 將十進位制數對應的八進位制、十六進位制、十進位制數輸出 Time Limit: 1 Sec Memory Limit: 128 MB Description 輸入一個十進位制數,轉換為對應的八進位制、十六進位制、十進位制數輸出 I
將十進位制轉換為二進位制、八進位制、十六進位制
將十進位制轉換為其它進位制時比較複雜,整數部分和小數部分的演算法不一樣。 1) 整數部分 十進位制整數轉換為 N 進位制整數採用“除 N 取餘,逆序排列”法。具體做法是: 將 N 作為除數,用十進位制整數除以 N,可以得到一個商和餘數; 保留餘數,用商繼續除以 N,又得到一個新的商和餘數;
進位制轉換:二進位制、八進位制、十六進位制、轉十進位制
將二進位制、八進位制、十六進位制等轉換為十進位制 二進位制、八進位制和十六進位制向十進位制轉換都非常容易,就是“按權相加”。所謂“權”,也即“位權”。 假設當前數字是 N 進位制,那麼: 對於整數部分,從右往左看,第 i 位的位權等於Ni-1 對於小數部分,恰好相反,要從左往右看,第 i 位
藍橋杯 基礎練習 十六進位制轉八進位制
基礎練習 十六進位制轉八進位制 時間限制:1.0s 記憶體限制:512.0MB 問題描述 給定n個十六進位制正整數,輸出它們對應的八進位制數。輸入格式
Python 八進位制轉換為十進位制程式碼
Python 八進位制轉換為十進位制的程式碼示例,包括了程式分析和程式原始碼,分享原始碼如下: #整數版 from functools import reduce n=[int(x) for x in input('輸入一個整數:')] print(reduce(lambda x,y:x*8+y,n)
易學筆記-第5章:數字/5.10 十六進位制、八進位制、二進位制
各種進製表示 二進位制開頭:0b >>> 0b1,0b1000,0b11111111 (1, 8, 255) 八進位制開頭 :0o >>> 0o10,0o20,0o30 (8, 16, 24) 十六進位制