ログインしてください。
提出 #2131573
ソースコード 拡げる
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define mp make_pair
#define pb push_back
#define x first
#define y second
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
char s[20];
int main()
{
scanf("%s",s);int n=strlen(s);
int ans=0;for (int i=0;i<n;i++) ans+=s[i]-48;
if (n>1) ans=max(ans,9*(n-1));
printf("%d\n",ans);
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | A - Digit Sum 2 |
| ユーザ | SanSiroWaltz |
| 言語 | C++14 (GCC 5.4.1) |
| 得点 | 0 |
| コード長 | 561 Byte |
| 結果 | WA |
| 実行時間 | 1 ms |
| メモリ | 128 KiB |
コンパイルエラー
./Main.cpp: In function ‘int main()’:
./Main.cpp:27:15: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%s",s);int n=strlen(s);
^
ジャッジ結果
| セット名 | Sample | All | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 0 / 300 | ||||||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | s1.txt, s2.txt, s3.txt |
| All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, s1.txt, s2.txt, s3.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 01.txt | AC | 1 ms | 128 KiB |
| 02.txt | AC | 1 ms | 128 KiB |
| 03.txt | AC | 1 ms | 128 KiB |
| 04.txt | AC | 1 ms | 128 KiB |
| 05.txt | WA | 1 ms | 128 KiB |
| 06.txt | WA | 1 ms | 128 KiB |
| 07.txt | AC | 1 ms | 128 KiB |
| 08.txt | AC | 1 ms | 128 KiB |
| 09.txt | AC | 1 ms | 128 KiB |
| 10.txt | WA | 1 ms | 128 KiB |
| 11.txt | AC | 1 ms | 128 KiB |
| 12.txt | WA | 1 ms | 128 KiB |
| s1.txt | AC | 1 ms | 128 KiB |
| s2.txt | WA | 1 ms | 128 KiB |
| s3.txt | WA | 1 ms | 128 KiB |