首页
DreamJudge
院校信息
考研初试
机试真题
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
cczz
2025年8月3日 17:04
进制转换2 题解:
P1259
回复 0
|
赞 3
|
浏览 231
#include<bits/stdc++.h> using namespace std; int main(){ char s[105]; while(scanf("%s",s) != EOF){ int res = 0; int len = strlen(s); for (int i = 2 ; i < len; i++){ res *= 16; if(s[i] >= '0' && s[i] <= '9') res += (s[i] - '0'); // else if(s...
苍灵
2025年6月25日 19:11
进制转换2 题解:C++ 懒人写法
P1259
回复 0
|
赞 2
|
浏览 285
#include<bits/stdc++.h> using namespace std; int main(){ string s; while(cin>>s){ int res=0,m; for(int i=s.length()-1;i>=2;i--){ m=s[i]-'0'; if(s[i]=='A'){ m=10; }else if(s[i]=='B'){ m=11; }else if(s[i]=='C'){ m=12; }else if(s[i]==...
阿灿
2025年3月18日 18:54
进制转换2 题解:scanf("%x",&x)这样不就好了吗兄弟们
P1259
回复 0
|
赞 7
|
浏览 1.3k
#include<bits/stdc++.h> using namespace std; int main(){ int x; while(scanf("%x",&x)!=EOF){ cout<<x<<endl; } }
西电机试专家
2025年3月11日 20:42
进制转换2 题解:very good
P1259
回复 0
|
赞 28
|
浏览 947
#include <bits/stdc++.h> using namespace std; int main(){ string s; while(cin>>s){ int ans=0; for(int i=2;i<s.size();i++){  ...
jaygee_
2025年3月6日 14:28
进制转换2 题解:
P1259
回复 0
|
赞 8
|
浏览 653
#include<bits/stdc++.h> using namespace std; int main() { string s; while(cin >> s) { cout << stoi(s, nullptr, 16) << endl; } return 0; }
chenxx
2025年2月26日 20:15
进制转换2 题解:
P1259
回复 1
|
赞 30
|
浏览 965
#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
|
赞 56
|
浏览 2.3k
用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
|
浏览 1.5k
使用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
|
赞 35
|
浏览 1.3k
//首先字符有大小写,然后范围有两段 //得到数以进制高位乘法,低位相加 #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
|
赞 7
|
浏览 929
#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; }
1
2
3
4
题目
进制转换2
题解数量
31
发布题解
在线答疑
热门题解
1
进制转换2 题解:
2
进制转换2 题解:
3
进制转换2 题解:
4
进制转换2 题解:very good
5
进制转换2 题解:
6
进制转换2 题解:
7
进制转换2 题解:
8
进制转换2 题解:
9
进制转换2 题解:使用sscanf()
10
进制转换2 题解:scanf("%x",&x)这样不就好了吗兄弟们