結果

問題 No.432 占い(Easy)
ユーザー AQUA16573837
提出日時 2018-04-09 22:56:06
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 571 bytes
コンパイル時間 1,222 ms
コンパイル使用メモリ 60,616 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-26 20:47:21
合計ジャッジ時間 1,883 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘void solve()’:
main.cpp:21:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |         scanf("%d", &t);
      |         ~~~~~^~~~~~~~~~
main.cpp:24:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   24 |                 scanf("%s", s);
      |                 ~~~~~^~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <algorithm>
#include <vector>
#include <deque>
#include <string>
#include <iostream>
using namespace std;
using ll = long long;

void solve();
int main() {
	solve();
#ifdef DBG
	while (true);
#endif
}

//432
void solve() {
	int t, len;
	scanf("%d", &t);
	char s[1001];
	for (int tcase = 0; tcase < t; tcase++) {
		scanf("%s", s);
		for (len = 0; s[len] != 0; len++)
			s[len] -= '0';
		for (;1 <= len; len--)
			for (int i = 0; i < (len - 1); i++) {
				s[i] += s[i + 1];
				s[i] = (s[i] % 10) + (s[i] / 10);
			}
		printf("%d\n", s[0]);
	}
}
0