結果
| 問題 |
No.64 XORフィボナッチ数列
|
| コンテスト | |
| ユーザー |
mban
|
| 提出日時 | 2016-10-12 17:40:24 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,111 bytes |
| コンパイル時間 | 953 ms |
| コンパイル使用メモリ | 112,032 KB |
| 実行使用メモリ | 28,728 KB |
| 最終ジャッジ日時 | 2024-11-22 01:28:56 |
| 合計ジャッジ時間 | 2,024 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 RE * 2 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Magatro
{
static void Main()
{
long[] N = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
if (N[2] % 3 == 0)
{
Console.WriteLine(N[0]);
}
else if (N[2] % 3 == 1)
{
Console.WriteLine(N[1]);
}
else
{
string a = Convert.ToString(N[0], 2);
string b = Convert.ToString(N[1], 2);
int l = Math.Max(a.Length, b.Length);
string f = string.Format("0:D{0}", l);
a = string.Format("{"+ f+"}", a);
b = string.Format("{"+f+"}", b);
string c = "";
for(int i = 0; i < l; i++)
{
if (a[i] == '1' ^ b[i] == '1')
{
c += "1";
}
else
{
c += "0";
}
}
Console.Write(Convert.ToInt64(c,2));
}
}
}
mban