首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
chenxx
2025年2月26日 20:15
进制转换2 题解:
P1259
回复 1
|
赞 31
|
浏览 1.5k
#include<bits/stdc++.h> using namespace std; int main(){ char s[100]; //scanf("%s", &s); while(cin>>s){ int n; int ans=0; ...
lingdongyang
2024年3月23日 17:18
进制转换2 题解:
P1259
回复 5
|
赞 73
|
浏览 2.9k
用gets(s)!=NULL只有50%正确率 scanf("%s",s)!=EOF才能100% 第一种 #include<stdio.h> #include<math.h> #include<string.h> int main() { //十六进制 //int a; //scanf("%d", &a); //printf("0x%X", a); char s[105] = { 0 }; //gets(s) != NULL while (scanf("%s",s)!...
AA蚊
2024年9月13日 10:27
进制转换2 题解:
P1259
回复 0
|
赞 13
|
浏览 2.0k
使用c++的hex流 #include<iostream> #include<sstream> using namespace std; int main() { string s; while (cin>>s) { stringstream ss; ss << s; ...
ccccccyes
2024年8月25日 03:29
进制转换2 题解:
P1259
回复 0
|
赞 37
|
浏览 1.7k
//首先字符有大小写,然后范围有两段 //得到数以进制高位乘法,低位相加 #include <iostream> #include <vector> using namespace std; string str; //dec是关键字 int main(){ while(cin>>str){ int len,num,sum = 0; ...
aglorice2
2024年8月22日 15:44
进制转换2 题解:使用sscanf()
P1259
回复 0
|
赞 8
|
浏览 1.2k
#include<stdio.h> int f(const char *s){ int ret = 0; sscanf(s,"%0x",&ret); return ret; } int main(){ char buff[100]; while(scanf("%s",buff)!=EOF){ printf("%d\n",f(buff)); } return 0; }
Agnes03
2024年7月27日 15:17
进制转换2 题解:
P1259
回复 0
|
赞 12
|
浏览 1.4k
#include <bits/stdc++.h> using namespace std; int main(){ string s; while(cin>>s){ int ans=0; for(int i=2;i<s.length();i++){//注意前面要跳过0x ans=ans*16; if(s[i]>='0'&&s[i]<='9'){ ans+=s[i]-'0'; }else{ ans+=s[i]-'A'+10; } } ...
myming
2024年7月20日 14:16
进制转换2 题解:
P1259
回复 1
|
赞 5
|
浏览 1.5k
#include<bits/stdc++.h> using namespace std; void f(char s[]){ char out[105]; int cnt = 0; int sum = 0; int len = strlen(s); for(int i = 2;i < len; i++){ &nbs...
18919717626
2024年6月29日 19:33
进制转换2 题解:
P1259
回复 0
|
赞 5
|
浏览 2.2k
浮点数运算误差:pow 函数在计算较大整数幂时可能会引入浮点数误差,导致结果不准确。 #include <iostream> #include <string> using namespace std; typedef long long LL; int main() { string s; while (cin >> s) { // 支持多组数据输入 LL ans = 0; int base = 1; // 十六进制最低位权重是 1 ...
15160115293
2024年5月8日 16:59
进制转换2 题解:
P1259
回复 0
|
赞 10
|
浏览 1.1k
#include<stdio.h> #include<string.h> char shiliu[17]="0123456789ABCDEF"; int main(){ char s[100]; while(scanf("%s",s)!=EOF){ int i,j,num=0,liu=1; for(i=strlen(s)-1;i>=2;...
Candour
2024年4月23日 00:21
进制转换2 (C&&C++ 最简短代码思路清晰)题解:
P1259
回复 0
|
赞 3
|
浏览 1.3k
格式化输入和输出 #include<bits/stdc++.h> using namespace std; int main() { int x; while(~scanf("%x", &x)) { printf("%d\n", x); } return 0; }
1
2
3
4
5
题目
进制转换2
题解数量
46
发布题解
在线答疑
热门题解
1
进制转换2 题解:
2
进制转换2 题解:
3
进制转换2 题解:
4
进制转换2 题解:very good
5
进制转换2 题解:
6
进制转换2 题解:
7
进制转换2 题解:scanf("%x",&x)这样不就好了吗兄弟们
8
进制转换2 题解:
9
进制转换2 题解:
10
进制转换2 题解: