結果

問題 No.544 Delete 7
ユーザー 14番
提出日時 2017-07-14 22:40:34
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 1,386 bytes
コンパイル時間 1,024 ms
コンパイル使用メモリ 113,880 KB
実行使用メモリ 36,684 KB
最終ジャッジ日時 2024-10-07 23:17:32
合計ジャッジ時間 3,921 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 2 TLE * 1 -- * 45
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

	public void Proc()
	{
        long num = long.Parse(Reader.ReadLine());
        long num1 = num;
        long num2 = 0;
        for (long i = 0; i <= num; i++) {
            
            if(num1.ToString().Any(a=>a=='7') || num2.ToString().Any(a=>a=='7') ) {
                
            } else {
                break;
            }
            int keta = 0;
            if(num1.ToString().IndexOf('7')>=0) {
                keta = num1.ToString().Length - num1.ToString().IndexOf('7'); 
            } else {
                keta = num2.ToString().Length - num2.ToString().IndexOf('7');
            }
            num1 -= int.Parse("1".PadRight(keta));
            num2 = num - num1;
         }
        Console.WriteLine(num1 + " " + num2);
    }


	public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"
 
 
17


 
";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}
0