Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"math"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	two := make([]float64, 12)
	flag := make([]int, 12)
	for i := 0; i < 12; i++ {
		two[i] = math.Pow(2.0, 7.0-float64(i))
	}
	for scanner.Scan() {
		n, _ := strconv.ParseFloat(scanner.Text(), 64)
		if n < 0 {
			break
		}
		for i := 0; i < 12; i++ {
			flag[i] = 0
			if n >= two[i] {
				n -= two[i]
				flag[i] = 1
			}
		}
		if n < 10e-10 {
			i := 0
			for i < 12 {
				fmt.Printf("%d", flag[i])
				if i == 7 {
					fmt.Printf(".")
				}
				i++
			}
			fmt.Printf("\n")
		} else {
			fmt.Println("NA")
		}
	}
}

C++: #include<cstdio>
#include<cmath>
#include<string>
using namespace std;

unsigned numLen(int n){
	char buf[100];
	return sprintf(buf, "%d", n);
}

int pow(int n, int a){
	int ret = 1;
	for(int i = 0;i < a;i++) ret *= n;
	return ret;
}

void reverse(string &str){
	unsigned len = str.length();
	char t;
	for(unsigned i = 0;i < len / 2;i++){
		t = str[i];
		str[i] = str[len - i - 1];
		str[len - i - 1] = t;
	}
}

string int2bin(int n){
	string ret;
	while(n){
		ret += '0' + (n % 2);
		n /= 2;
	}
	reverse(ret);
	return ret;
}

string double2bin(int r){
	unsigned d = numLen(r);
	string ret;
	for(int i = 0;i < 5;i++){
		r *= 2;
		if(numLen(r) > d){
			ret += '1';
			r -= pow(10, d);
		}
		else{
			ret += '0';
		}
		if(r == 0) break;
	}
	for(int i = ret.length();i < 4;i++) ret += '0';
	return ret;
}

int main(){
	while(1){
		int n, r;
		scanf("%d.%d", &n, &r);
		if(n < 0) break;
		string ansN = int2bin(n), ansR = double2bin(r);
		if(ansN.length() > 8 || ansR.length() > 4) printf("NA\n");
		else printf("%08s.%04s\n", ansN.c_str(), ansR.c_str());
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int stoi(string s) {
  int ans = 0;
  for(int i = 0; i < s.length(); i++) {
    ans += (int)(s[i]-'0') * (int)pow(10.0, (int)(s.length() - i - 1));
  }
  return ans;
}

string _10to2(int n) {
  string s;
  if(n == 0) return "";
  if(n % 2 == 0) {
    s = "0";
  } else {
    s = "1";
  }
  return _10to2(n/2)+s;
}

string _10to2f(double f) {
  string s;
  if(f == 0.0) return "";
  f *= 2;
  if(f < 1.0) {
    s = "0";
  } else {
    s = "1";
    f -= 1.0;
  }
  return s+_10to2f(f);
}

int main() {
  while(1) {
    double n;
    cin >> n;
    if(n == -1.0) break;
    int r = (int)n;
    double f = n-r;
    string sr = _10to2(r);
    string sf = _10to2f(f);
    if(sr.length() <= 8 && sf.length() <= 4) {
      printf("%.8d.%.4d\n", stoi(sr), stoi(sf)*(int)pow(10.0, (int)(4-sf.length())));
    } else {
      cout << "NA" << endl;
    }
  }
  return 0;
}

C++: #include<iostream>

using namespace std;

int main(void){
  double in;
  while(cin>>in,in!=-1){
    if(in>128){cout<<"NA";continue;}
    cout<<(64<=in&&in<128?1:0);
    if(64<=in)in-=64;
    cout<<(32<=in&&in<64?1:0);
    if(32<=in)in-=32;
    cout<<(16<=in&&in<32?1:0);
    if(16<=in)in-=16;
    cout<<(8<=in&&in<16?1:0);
    if(8<=in)in-=8;
    cout<<(4<=in&&in<8?1:0);
    if(4<=in)in-=4;
    cout<<(2<=in&&in<4?1:0);
    if(2<=in)in-=2;
    cout<<(1<=in&&in<2?1:0);
    if(1<=in)in-=1;
    cout<<".";
    cout<<(0.5<=in&&in<0?1:0);
    if(0.5<=in)in-=0.5;
    cout<<(0.25<=in&&in<0.5?1:0);
    if(0.25<=in)in-=0.25;
    cout<<(0.125<=in&&in<0.25?1:0);
  }
}

C++: #include <iostream>
using namespace std;

char solve(int m,int e,int j){
	if( m == 100 || e == 100 || j == 100 )
		return 'A';
	if( (m+e)>=180 || (m+e+j)>=240)
		return 'A';
	if( (m+e+j)>=210 || ( (m+e+j)>=150 && (m>=80||e>=80) ) )
		return 'B';
	return 'C';
}

int main(){
	int n,m,e,j;
	while( cin >> n , n ){
		for(int i=0 ; i<n ; ++i ){
			cin >> m >> e >> j;
			cout << solve(m,e,j) << endl;
		}
	}
}

C++: #define _USE_MATH_DEFINES
#define INF 10000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;

static const double eps = 1e-8;

int main(){
	double n;	
	while(~scanf("%lf",&n)){
		if(n==-1.0) break;
		int a = n;
		double b = n - (double)a;

		bitset<8> front;
		for(int i=0;i<8;i++){
			if(a & (1<<i)) front |= (1<<i);
		}

		bitset<4> rear;
		for(int i=0;i<4;i++){
			b*=2.0;
			if(b + eps > 1.0){
				rear |= (1<<i);
				b -= 1.0;
			}
		}

		if(!(b+eps > 0.0 && b-eps < 0.0) || a != front.to_ulong()) {
			printf("NA\n");
		}
		
		
		else {
			string r = rear.to_string();
			reverse(r.begin(),r.end());
			printf("%s.%s\n",front.to_string().c_str(),r.c_str());
		}
	}
}

C++: /*
	AOJ_0220:Binary Digit A Doctor Loved
*/
#include	<iostream>
#include	<string>

using namespace std;

string convert_toDigit(double);

int main(void) {
	double input;

	while (1) {
		cin >> input;

		if (input < 0.0) { break; }
		cout << convert_toDigit(input) << endl;
	}
	return 0;
}

string convert_toDigit(double targetNum) {
	string ans;
	double progressNum = 128.0;

	while (progressNum > 0.03125) {

		if (targetNum >= progressNum) {
			ans += '1';
			targetNum -= progressNum;
		} else {
			ans += '0';
		}
		progressNum /= 2;
		if (progressNum == 0.5) { ans += '.'; }
	}
	if (targetNum == 0.0) { return ans; }
	else { return "NA"; }
}

C++: /* 23 - 35 */

#include <iostream>
#include <algorithm>
using namespace std;

string db(int n){
	string ret;
	for(int i=0;i<8;i++){
		ret+='0'+n%2;
		n/=2;
	}
	reverse(ret.begin(),ret.end());
	
	return ret;
}

string check(double n){
	double table[] = {1.0/2,1.0/4,1.0/8,1.0/16};
	for(int i=0;i<(1<<4);i++){
		double sum = 0;
		string ret = "";
		for(int j=0;j<4;j++){
			if( i & (1<<j) ){
				sum += table[j];
				ret += "1";
			}else{
				ret += "0";
			}
		}
		if(sum == n)return ret;
	}
	return "";
}
int main(){
	double n,dbl;
	
	while(cin >> n , n>=0 ){
		dbl = n-(int)n;
		if( (int)n < (1<<8) && check(dbl) != ""){
			cout << db( (int)n ) << "." << check(dbl) << endl;
		}else{
			cout << "NA" << endl;
		}
			
	}
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int main(void)
{
	double a;
	int i;
	char box[12]={'0','0','0','0','0','0','0','0','0','0','0','0'};
	double nisin[12]={128.0,64.0,32.0,16.0,8.0,4.0,2.0,1.0,0.5,0.25,0.125,0.0625};

	cin >> a;
	while(a>0.0){
		for(i=0;i!=12;i++){
			if(a>=nisin[i]){
				a=a-nisin[i];
				box[i]='1';
			}
		}
		if(a==0.0){
			for(i=0;i!=12;i++){
				cout << box[i];
				if(i==7){
					cout << '.';
				}
			}
		}
		else{ 
			cout << "NA";
		}
		cout << endl;
		cin >> a;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
using namespace std;
int main(){
	double n;

		//for(int i=0;i<ans.size();i++)cout<<ans[i]<<" ";cout<<endl;
	while(cin>>n,n!=-1.0){
	vector<bool>ans(0);
	queue< vector<bool> >bfs;
	bfs.push(ans);
	while(!bfs.empty()){
		vector<bool>tmp=bfs.front();
		bfs.pop();
		if(tmp.size()>12){
		cout<<"NA"<<endl;
		break;
		}
		double sum=0;
		for(int i=0;i<8;i++)if(tmp[i])sum+=pow(2,7-i);
		for(int i=0;i<4;i++)if(tmp[8+i])sum+=pow(2,-1*(i+1));
		if(sum==n){
		for(int i=0;i<tmp.size();i++){
		cout<<tmp[i];
		if(i==7)cout<<'.';
		}
		for(int i=0;i<12-tmp.size();i++)cout<<'0';
		cout<<endl;
		break;
		}
		tmp.push_back(0);
		bfs.push(tmp);
		tmp.erase(tmp.begin()+(tmp.size()-1));
		tmp.push_back(1);
		bfs.push(tmp);
	}
	}
}